Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Run as .service #32

Open
zuhra031 opened this issue Jun 10, 2019 · 0 comments
Open

Run as .service #32

zuhra031 opened this issue Jun 10, 2019 · 0 comments

Comments

@zuhra031
Copy link

Hi,
Im trying to run mqtt-gpio-monitor as service on boot @ rasbian (latest)

.service file (/lib/systemd/system/mqtt-gpio-monitor-service.service)

[Unit]
Description=MQTT Buttons
After=multi-user.target

[Service]
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=MQTTGPIOMon
User=pi
Group=pi
WorkingDirectory=/home/pi/gregorb/mqtt-gpio-monitor/
ExecStart=/usr/bin/python3 /home/pi/gregorb/mqtt-gpio-monitor/mqtt-gpio-monitor.py

[Install]
WantedBy=multi-user.target

when i run enable and then status I get

● mqtt-gpio-monitor-service.service - MQTT Buttons
   Loaded: loaded (/lib/systemd/system/mqtt-gpio-monitor-service.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-06-09 23:03:48 CEST; 24h ago
 Main PID: 899 (code=exited, status=2)

Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Unit entered failed state.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Failed with result 'exit-code'.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Service hold-off time over, scheduling restart.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: Stopped MQTT Buttons.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Start request repeated too quickly.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: Failed to start MQTT Buttons.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Unit entered failed state.
Lip 09 23:03:48 WiseMagicMirror systemd[1]: mqtt-gpio-monitor-service.service: Failed with result 'exit-code'.

When i try to run it via terminal with command
/usr/bin/python3 /home/pi/gregorb/mqtt-gpio-monitor/mqtt-gpio-monitor.py
I get

Traceback (most recent call last):
  File "/usr/lib/python3.5/configparser.py", line 1135, in _unify_values
    sectiondict = self._sections[section]
KeyError: 'global'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/gregorb/mqtt-gpio-monitor/mqtt-gpio-monitor.py", line 30, in <module>
    MODULE = config.get("global", "module")
  File "/usr/lib/python3.5/configparser.py", line 778, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.5/configparser.py", line 1138, in _unify_values
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'global'

when i cd to root dir of script, I can run it with python3 mqtt-gpio-monitor.py.

Any ideas how to run it as service?
Thanks,
G.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant