summaryrefslogtreecommitdiff
blob: 5c9bd9225dae0a6e9c7c77fe6d7a704ee92e099f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
commit 5f0d3dbcdb5f1f1f9d019619c4e3dd3b2f2d29f3
Author: Peter Volkov <pva@gentoo.org>
Date:   Tue Mar 31 12:31:01 2009 +0400

    Issue warning if cronjobs aren't automatically set
    
    Init script is supposed to set cronjobs automatically on start and remove
    them on stop. This works only with cron daemons that may hook at runtime
    scripts at ${DST_CRONSCRIPT_DIR} (e.g. sys-process/vixie-cron can). For
    other cron daemons it's safer to warn users to set cronjobs manually.

diff --git a/etc/init.d/vz-gentoo.in b/etc/init.d/vz-gentoo.in
index 97ea313..dc87d41 100755
--- a/etc/init.d/vz-gentoo.in
+++ b/etc/init.d/vz-gentoo.in
@@ -57,7 +57,19 @@ check_config() {
 setup_cron()
 {
 	[ -z "$SRC_CRONSCRIPT_DIR" ] && return
-	[ -d "$DST_CRONSCRIPT_DIR" ] || return
+	if [ ! -d "${DST_CRONSCRIPT_DIR}" ]; then
+		if [ "x${SKIP_CRON_WARNINGS}" != "xyes" ]; then
+			ewarn "Automatic setup of cron jobs works only if a system cron daemon can use"
+			ewarn "\${DST_CRONSCRIPT_DIR} (${DST_CRONSCRIPT_DIR}) as a spool directory"
+			ewarn "(e.g. sys-process/vixie-cron can). On your system ${DST_CRONSCRIPT_DIR}"
+			ewarn "is not a directory even, thus you need manually set the following cron jobs:"
+			ewarn "*/5 * * * * root  @PKGDATADIR@/scripts/vpsnetclean"
+			ewarn "*/5 * * * * root  @PKGDATADIR@/scripts/vpsreboot"
+			ewarn "If you already did that and wish to avoid this warning put"
+			ewarn "SKIP_CRON_WARNINGS=yes into /etc/conf.d/vz."
+		fi
+		return
+	fi
 	install -m644 -o root -g root $SRC_CRONSCRIPT_DIR/vz \
 		$DST_CRONSCRIPT_DIR
 }