1#!/bin/sh 2 3start() { 4 printf "Starting mosquitto: " 5 start-stop-daemon -S -q -m -b -p /var/run/mosquitto.pid \ 6 --exec /usr/sbin/mosquitto \ 7 -- -c /etc/mosquitto/mosquitto.conf 8 [ $? = 0 ] && echo "OK" || echo "FAIL" 9} 10stop() { 11 printf "Stopping mosquitto: " 12 start-stop-daemon -K -q -p /var/run/mosquitto.pid 13 [ $? = 0 ] && echo "OK" || echo "FAIL" 14} 15restart() { 16 stop 17 start 18} 19 20case "$1" in 21 start) 22 start 23 ;; 24 stop) 25 stop 26 ;; 27 restart|reload) 28 restart 29 ;; 30 *) 31 echo "Usage: $0 {start|stop|restart}" 32 exit 1 33esac 34 35exit $? 36