diff options
Diffstat (limited to 'chat/silc-server/files/silcd.generic')
-rw-r--r-- | chat/silc-server/files/silcd.generic | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/chat/silc-server/files/silcd.generic b/chat/silc-server/files/silcd.generic new file mode 100644 index 00000000000..c8280e49670 --- /dev/null +++ b/chat/silc-server/files/silcd.generic @@ -0,0 +1,82 @@ +# $NetBSD: silcd.generic,v 1.1 2002/05/03 22:02:49 hubertf Exp $ +# + +KILL="/bin/kill" +CAT="/bin/cat" +RM="/bin/rm" + +name="silcd" +confdir="@PKG_SYSCONFDIR@" +required_files="$confdir/silcd.conf" +required_dirs="/var/log/silcd" +pidfile="/var/log/silcd/${name}.pid" +command="@PREFIX@/sbin/silcd" +start_precmd="silcd_precmd" + +silcd_precmd() { + if [ ! -f $confdir/silcd.prv ]; then + $command -C $confdir + fi +} + +silcd_start() { + if [ ! -r $required_files ]; then + echo "$0: WARNING: $required_files is not readable." + exit 1 + fi + if [ ! -d $required_dirs ]; then + echo "$0: WARNING: $required_dirs is not a directory." + exit 1 + fi + + eval $start_precmd + return_code=$? + if [ $return_code != "0" ]; then + exit 1 + fi + + echo "Starting ${name}." + eval $command + return_code=$? + if [ $return_code != "0" ]; then + exit 1 + fi +} + + +silcd_stop() { + if [ -r $pidfile -a ! -z $pidfile ]; then + _pid=`${CAT} ${pidfile}` + else + echo "${name} not running?" + fi + if [ ${_pid:=0} -gt 1 -a ! "X$_pid" = "X " ]; then + echo "Stopping ${name}." + ${KILL} ${_pid} + return_code=$? + if [ $return_code != "0" ]; then + exit 1 + fi + fi + ${RM} -f $pidfile +} + +case $1 in + +'start') + silcd_start + ;; + +'stop') + silcd_stop + ;; + +'restart') + silcd_stop + silcd_start + ;; + +*) + echo "Usage: $0 (start|stop|restart)" + ;; +esac |