Linux and Coffee Lover, Father of @SlackwareSecAdv - Software Engineer at Walmart
Slackware mosquitto script
May
18th,
2017
#!/bin/sh## Mosquitto daemon control script.# Written for Slackware Linux by Jose Bovet Derpich <[email protected]>.BIN=/usr/sbin/mosquitto
CONF=/etc/mosquitto/mosquitto.conf
# enable pid_file in /etc/mosquitto/mosquitto.confPID=/var/run/mosquitto.pid
mosquitto_start(){if[!-r$CONF];then# no config file, exit:echo"$CONF does not appear to exist. Abort."exit 1
fi
if[-s$PID];then
echo"Mosquitto appears to already be running?"exit 1
fi
echo"Starting Mosquitto server daemon..."if[-x$BIN];then$BIN-c$CONF-dfi}
mosquitto_stop(){echo"Shutdown Mosquitto..."if[-r$PID];then
kill-TERM$(cat$PID)rm$PIDfi}
mosquitto_restart(){
mosquitto_stop
sleep 3
mosquitto_start
}case"$1"in
start)
mosquitto_start
;;
stop)
mosquitto_stop
;;
restart)
mosquitto_restart
;;*)echo"usage: `basename$0` {start|stop|restart}"esac