1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-10-05 19:18:01 +08:00
ULib/tests/examples/wi-auth/bin/init/wifi-portal-firenze.logrotate.init.d
2015-01-23 17:24:36 +01:00

69 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# lg's wifi-portal logrotate rc script
#
# last modified: 2010/04/22
#
# WARNING:
#
# heartbeat needs rc scripts, aka resource agents, to be LSB compatible:
#
# *** start/stop actions ALWAYS exit 0 ***
#
# implement status action and exit accordingly
# 0 = running
# 1 = dead (... but pid file exists)
# 2 = dead (... but lock file exists)
# 3 = not running/stopped/unused
#
# description: Start wifi-portal firenze logrotate
# chkconfig: 2345 95 05
descr='wifi-portal firenze logrotate'
conffile=/srv/wifi-portal-firenze/etc/wifi-portal-firenze.logrotate.conf
test -f /etc/ha.d/shellfuncs && {
. /etc/ha.d/shellfuncs
alias log="ha_log $descr: " ; } ||
alias log="echo $descr: "
. /etc/init.d/functions
case "$1" in
start)
$0 status && exit 0
log 'starting'
ln -s $conffile /etc/logrotate.d/
success ; echo ;;
stop)
log 'stopping'
rm /etc/logrotate.d/`basename $conffile`
success ; echo ;;
status)
log 'checking'
test -h /etc/logrotate.d/`basename $conffile` && {
log '..running' ; exit 0 ; } || {
log '..stopped' ; exit 3 ; }
exit $? ;;
*)
echo "usage: $0 (start|stop|status)"
exit 1 ;;
esac
exit 0