sysklogd: improved rc script

This commit is contained in:
Juergen Daubert 2015-06-26 12:22:36 +02:00
parent fbcb7ac028
commit b8894cebe1
3 changed files with 31 additions and 9 deletions

View File

@ -1,5 +1,5 @@
41dfad9077311e159c793216adf90723 rotatelog
a1bb71ed6b0ce791cb7f9fa0089a09ef sysklogd
b34c927b05f072083d801deba5420e80 sysklogd
c70599ab0d037fde724f7210c2c8d7f8 sysklogd-1.5.1.tar.gz
844e5e75944beb8cf4f39a0535e56ba4 syslog
f8d478b8d60c1d3879f4a10a955db6e5 syslog.conf

View File

@ -4,7 +4,7 @@
name=sysklogd
version=1.5.1
release=1
release=2
source=(http://www.infodrom.org/projects/$name/download/$name-$version.tar.gz \
rotatelog syslog syslog.conf sysklogd)

View File

@ -1,23 +1,45 @@
#!/bin/sh
#
# /etc/rc.d/sysklogd: start/stop sysklogd logging daemons
# /etc/rc.d/sysklogd: start/stop syslog and klog daemons
#
SSD=/sbin/start-stop-daemon
SLOG=/usr/sbin/syslogd
KLOG=/usr/sbin/klogd
SLOG_PID=/var/run/syslogd.pid
KLOG_PID=/var/run/klogd.pid
print_status() {
$SSD --status --pidfile $2
case $? in
0) echo "$1 is running with pid $(cat $2)" ;;
1) echo "$1 is not running but the pid file $2 exists" ;;
3) echo "$1 is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
}
case $1 in
start)
/usr/sbin/syslogd
/usr/sbin/klogd -c 4
$SSD --start --pidfile $SLOG_PID --exec $SLOG
$SSD --start --pidfile $KLOG_PID --exec $KLOG -- -c4
;;
stop)
/usr/bin/killall syslogd
/usr/bin/killall klogd
$SSD --stop --retry 10 --pidfile $SLOG_PID
$SSD --stop --retry 10 --pidfile $KLOG_PID
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
print_status $SLOG $SLOG_PID
print_status $KLOG $KLOG_PID
;;
*)
echo "usage: $0 [start|stop|restart]"
echo "usage: $0 [start|stop|restart|status]"
;;
esac
# End of file