emqttd not starting as service on boot?

183 views
Skip to first unread message

organicmo...@gmail.com

unread,
Jun 16, 2017, 3:19:17 AM6/16/17
to emqtt
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

organicmo...@gmail.com

unread,
Jun 16, 2017, 3:25:19 AM6/16/17
to emqtt, organicmo...@gmail.com
Okay, for the officiados, here is time measure the other way:

root@house:~# time /etc/init.d/mqtt start
Starting eqmttd
emqttd 2.2 is started successfully!

real    0m24.147s
user    0m16.730s
sys     0m4.320s

organicmo...@gmail.com

unread,
Jun 16, 2017, 11:24:55 AM6/16/17
to emqtt, organicmo...@gmail.com
Belay that last question about the timeout.  The property turns out to be TimeoutStartUSec which is currently set to 5min.  I assume the U is User seconds??   In any event, it doesn't then seem to be a timeout problem after all.

Over to you blue leader.

organicmo...@gmail.com

unread,
Jun 17, 2017, 10:32:15 AM6/17/17
to emqtt, organicmo...@gmail.com

organicmo...@gmail.com

unread,
Jun 17, 2017, 9:14:10 PM6/17/17
to emqtt, organicmo...@gmail.com
Short shrift script runs as "/etc/init.d/mqtt start" from console but does not run as "service mqtt start" or "sysmctl start mqtt" both of which call "/etc/init.d/mqtt start" nor does it run on boot??

On armbian debian server so what else needs to be done please?

I note on web there is options for stuffing service junk into /etc/systemd/system/mqtt.service or /usr/lib/systemd/system/mqtt.service of form:

[Unit]
Description=EMQ Broker
After=syslog.target
After=network.target

[Service]
Type=forking
TimeoutSec=60
Restart=always
RestartSec=10
Environment=HOME=/root
ExecStart=/opt/emqttd/bin/emqttd start
ExecStop=/opt/emqttd/bin/emqttd stop

With so many "options", and with many of them not working, an silence on group, it doesn't bode well for using emqttd in production.  How many people are being turned away from emqttd with problems like this?

organicmo...@gmail.com

unread,
Jun 17, 2017, 10:07:16 PM6/17/17
to emqtt, organicmo...@gmail.com
So, true or false?

emqttd does not take into account whether systemd breaks if a console is start during service (and therefore during boot)?


Reply all
Reply to author
Forward
0 new messages