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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#! /bin/sh
#
# This is an init script created for a S.u.S.E. 6.2 distribution.
#
# Author: CW Zuckschwerdt <zany@triq.net>
#
# /sbin/init.d/lircd
#
# and symbolic its link
#
# /sbin/rc?.d/K20lircd
# /sbin/rc?.d/S20lircd
#
. /etc/rc.config
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# Force execution if not called by a runlevel directory.
test $link = $base && START_LIRCD=yes
# test "$START_LIRCD" = yes || exit 0
# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
start)
echo -n "Starting daemon lircd"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc /usr/local/sbin/lircd || return=$rc_failed
echo -e "$return"
;;
stop)
echo -n "Shutting down daemon lircd"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM /usr/local/sbin/lircd || return=$rc_failed
echo -e "$return"
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop && $0 start || return=$rc_failed
;;
reload)
## both lircd and lircmd will re-read their
## config files on receipt of SIGHUP
echo -n "Reload daemon lircd"
killproc -HUP /usr/local/sbin/lircd || return=$rc_failed
echo -e "$return"
;;
status)
echo -n "Checking for daemon lircd: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
checkproc /usr/local/sbin/lircd && echo OK || echo No process
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0
|