#!/bin/sh
# Start/stop/restart the system logging daemon.
#
# Written for Slackware Linux by Patrick J. Volkerding <volkerdi@slackware.com>.

# Source default settings:
if [ -r /etc/default/syslogd ]; then
  . /etc/default/syslogd
fi

syslogd_start() {
  if [ -x /usr/sbin/syslogd ]; then
    echo "Starting syslogd daemon:  /usr/sbin/syslogd ${SYSLOGD_OPTS}"
    /usr/sbin/syslogd $SYSLOGD_OPTS
  fi
}

syslogd_stop() {
  killall --ns $$ -TERM syslogd 2> /dev/null
}

syslogd_restart() {
  syslogd_stop
  timeout 1 pwait --ns $$ -U root -P 1 syslogd
  syslogd_start
}

case "$1" in
'start')
  syslogd_start
  ;;
'stop')
  syslogd_stop
  ;;
'restart')
  syslogd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac