examples/etc/init.d/oneacct-export-cron
#!/bin/sh
### BEGIN INIT INFO
# Provides: oneacct-export-cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enable hourly run of oneacct-export
# Description: This shell script enables the automatic use of oneacct-export
### END INIT INFO
lockfile="/var/lock/oneacct-export-cron"
retval=0
name=`basename $0`
start() {
touch $lockfile
echo "Enabling periodic $name"
retval=0
}
stop() {
rm -f $lockfile
echo "Disabling periodic $name"
retval=0
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
restart
;;
reload)
;;
condrestart)
[ -f "$lockfile" ] && restart
;;
status)
if [ -f "$lockfile" ] ; then
echo "Periodic $name is enabled"
retval=0
else
echo "Periodic $name is disabled"
retval=3
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
retval=1
esac
exit $retval