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