1#!/bin/sh 2 3DAEMON="rsyslogd" 4PIDFILE="/var/run/$DAEMON.pid" 5 6RSYSLOGD_ARGS="" 7 8# shellcheck source=/dev/null 9[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" 10 11start() { 12 printf 'Starting %s: ' "$DAEMON" 13 # shellcheck disable=SC2086 # we need the word splitting 14 start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ 15 -- $RSYSLOGD_ARGS 16 status=$? 17 if [ "$status" -eq 0 ]; then 18 echo "OK" 19 else 20 echo "FAIL" 21 fi 22 return "$status" 23} 24 25stop() { 26 printf 'Stopping %s: ' "$DAEMON" 27 start-stop-daemon -K -q -p "$PIDFILE" 28 status=$? 29 if [ "$status" -eq 0 ]; then 30 echo "OK" 31 else 32 echo "FAIL" 33 fi 34 return "$status" 35} 36 37restart() { 38 stop 39 sleep 1 40 start 41} 42 43case "$1" in 44 start|stop|restart) 45 "$1";; 46 reload) 47 # Restart, since there is no true "reload" feature (does not 48 # reconfigure/restart on SIGHUP, just closes all open files). 49 restart;; 50 *) 51 echo "Usage: $0 {start|stop|restart|reload}" 52 exit 1 53esac 54