Community
OpenEnergyMonitor

Community

V9.9.0: Migrating to the new systemd+python service-runner


(Greebo) #1

Migrating to the new systemd+python service-runner:
As the name implies, this requires both systemd and python to be installed and configured on your system. Testing was done with python 2.7 but there shouldn’t be any python 3 breaking code in there. systemd is installed by default on Raspbian jessie (and later) as a replacement for the SysV init system to control the startup and shutdown of the operating system (Wkipedia systemd).

To migrate your system from the cron initiated, bash based service-runner requires a few manual steps:

Install the new service-runner systemd service following the instructions in the downloaded file emoncms/scripts/service/install-service-runner-update.md (also in github)

Disable the crontab that runs the existing bash script. The crontab entry looks like this:

* * * * * /home/pi/emonpi/service-runner >> /var/log/service-runner.log 2>&1

Either delete the entry completely or add a # as the first character to “comment it out”. On the emonSD image, this will be in the pi user’s crontab which can be edited by running the following from an ssh session as the user pi:

rpi-rw
crontab -e

which should look like this:

[email protected](ro):~$ rpi-rw
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
[email protected](rw):~$ crontab -e
crontab: installing new crontab

If you don’t see the crontab: installing new crontab line, run crontab -e again and make sure you save the file (with the default name if prompted)

Finally check the emoncms update script to ensure it didn’t re-add the crontab entry.
The latest master branch of https://github.com/openenergymonitor/emonpi has removed the necessary lines, which you can see here:
https://github.com/openenergymonitor/emonpi/commit/964545c19a0b8582c411b7a9e00b773fa7fe925b#diff-8b4978eb22e685baa067f42e6fac6156L46 (specifically the removed lines 46 to 69)


Emoncms v9.9.0+ release notes
2018 Development Progress Update
Is Publish to MQTT broken by 9.9.x due to library change?
(Glyn Hudson) #2

Thanks @Greebo that’s a good guide :+1: