Okay, so I ignored the example service description on emqttd site.
My version is the following:
#! /bin/sh
# /etc/init.d/mqtt
case "$1" in
start)
echo "Starting eqmttd"
/opt/emqttd/bin/emqttd start
;;
stop)
echo "Stopping emqttd"
/opt/emqttd/bin/emqttd stop
;;
restart)
echo "Restarting emqttd"
/opt/emqttd/bin/emqttd stop
/opt/emqttd/bin/emqttd start
;;
*)
echo "Usage: /etc/init.d/mqtt {start|stop|restart}"
/opt/emqttd/bin/emqttd stop
/opt/emqttd/bin/emqttd start
;;
*)
echo "Usage: /etc/init.d/mqtt {start|stop|restart}"
exit 1
esac
This runs fine from command line with:
service mqtt start
However it doesn't start on boot, returning the following using systemctl status mqtt.service:
root@house:~# systemctl -l status mqtt.service
? mqtt.service - (null)
Loaded: loaded (/etc/init.d/mqtt)
Active: failed (Result: exit-code) since Fri 2017-06-16 08:46:52 CEST; 24min ago
Process: 979 ExecStart=/etc/init.d/mqtt start (code=exited, status=1/FAILURE)
Jun 16 08:46:36 house mqtt[979]: Starting eqmttd
Jun 16 08:46:52 house systemd[1]: mqtt.service: control process exited, code=exited status=1
Jun 16 08:46:52 house systemd[1]: Failed to start (null).
Jun 16 08:46:52 house systemd[1]: Unit mqtt.service entered failed state.
When I time the service start from the command line I get:
root@house:~# time /opt/emqttd/bin/emqttd start
emqttd 2.2 is started successfully!
real 0m21.635s
user 0m14.340s
sys 0m3.900s
Dumb question then, since it runs from command line, is this as simple as it is taking too long to start on boot so is being dumped?
Is there a trick for giving this service longer to start?
Cheers,
A