I have written a systemd script mqtt.service
which is in /home/root
directory
This is my mqtt.service
script :
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=mqtt
DefaultDependencies=no
After=xdk-daemon.service
[Service]
Restart=always
RestartSec=10
ExecStart=/bin/sh /home/root/mosquitto-1.4/mqtt_start.sh
[Install]
WantedBy=multi-user.target
And this is the content of mqtt_start.sh
#!/bin/sh
/home/root/mosquitto-1.4/src/mosquitto -c /home/root/mosquitto-1.4/mosquitto.conf -d -p 1885 > /dev/null 2>&1
If I paste the line :
/home/root/mosquitto-1.4/src/mosquitto -c /home/root/mosquitto-1.4/mosquitto.conf -d -p 1885
into terminal, the mqtt broker starts normally But here I am not able to start it
I did
$ systemctl enable /home/root/mqtt.service
$ systemctl status mqtt.service
● mqtt.service - mqtt
Loaded: loaded (/home/root/mqtt.service; enabled)
Active: failed (Result: resources) since Mon 2015-04-06 10:42:48 UTC; 24s ago
Main PID: 677 (code=exited, status=0/SUCCESS)
Apr 06 10:42:39 edison sh[677]: 1428316959: Warning: Mosquitto should not be run as root/administrator.
Apr 06 10:42:48 edison systemd[1]: mqtt.service holdoff time over, scheduling restart.
Apr 06 10:42:48 edison systemd[1]: mqtt.service failed to schedule restart job: Unit mqtt.service failed to load: No such file or directory.
Apr 06 10:42:48 edison systemd[1]: Unit mqtt.service entered failed state.
Let me know where I have mistaken.
EDIT :
after I reboot I did:
systemctl status mqtt.service and result :
● mqtt.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)