blob: e57421a97b8f1269771493a5859c946fa4b631a1 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-process/fcron/files/fcron.init,v 1.3 2007/04/14 15:57:05 wschlich Exp $
depend() {
use logger slapd mysql postgresql
need clock hostname
# provide the cron service if we are the main instance
if [ "${SVCNAME}" = "fcron" ]; then
provide cron
fi
}
checkconfig() {
FCRON_INSTANCE=${SVCNAME##*.}
if [ -n "${FCRON_INSTANCE}" -a "${SVCNAME}" != "fcron" ]; then
FCRON_CONF=/etc/fcron/fcron.${FCRON_INSTANCE}.conf
else
FCRON_CONF=/etc/fcron/fcron.conf
fi
if [ ! -e ${FCRON_CONF} ]; then
eerror "You will need an ${FCRON_CONF} first"
eerror "There is a sample in /etc/fcron"
return 1
fi
FCRON_PIDFILE=$(grep '^pidfile' ${FCRON_CONF} 2>/dev/null | sed -e 's:^pidfile[[:space:]]*=[[:space:]]*\(.*\)$:\1:')
FCRON_PIDFILE=${FCRON_PIDFILE:-/var/run/fcron.pid}
FCRON_SPOOLDIR=$(grep '^fcrontabs' ${FCRON_CONF} 2>/dev/null | sed -e 's:^fcrontabs[[:space:]]*=[[:space:]]*\(.*\)$:\1:')
FCRON_SPOOLDIR=${FCRON_SPOOLDIR:-/var/spool/cron/fcrontabs}
if [ ! -d ${FCRON_SPOOLDIR} ]; then
ebegin "Creating missing spooldir ${FCRON_SPOOLDIR}"
/usr/sbin/fcron --newspooldir ${FCRON_SPOOLDIR}
eend $?
fi
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --pidfile ${FCRON_PIDFILE} --exec /usr/sbin/fcron -- -c ${FCRON_CONF}
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile ${FCRON_PIDFILE}
eend $?
}
|