freddie wrote: ↑Sat 29 Aug 2020 2:28 pm
For a systemd service, its configuration is stored in a file known as a
unit. To create a unit for Cumulus MX, create a file called cumulusmx.service in /etc/systemd/system/. Pop this code into the file:
Code: Select all
[Unit]
Description=CumulusMX service
Documentation=https://cumuluswiki.org/a/Main_Page
After=network-online.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service
Type=forking
ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock
[Install]
WantedBy=multi-user.target
[Service] section notes: you should modify the
ExecStart line to suit your system.
/usr/bin/mono-service is the path to the mono-service executable (should be pretty standard across all systems, but I would double-check it is there).
-d:/home/install/CumulusMX is the location of your Cumulus MX installation. Also, modify
User and
Group to suit your local setup. Lastly,
ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock is for systemd to remove the lock file created on service startup in order to signal successful startup/shutdown.
Cumulus is started and stopped with the following commands:
Code: Select all
systemctl start cumulusmx
systemctl stop cumulusmx
Status and restart are available too:
Code: Select all
systemctl restart cumulusmx
systemctl status cumulusmx
If you make a change to the unit file, you need to run the following command so that systemd re-reads your file:
There is no need to do this when you first create the unit file.
To have Cumulus start on reboot, issue the following command:
Finally, to stop the service running on reboot, use the following:
NOTE:
All the above systemctl commands should be run as root (or prefixed with sudo) - except for status which can be executed by a normal user.
The unit file can be called whatever you want, provided it is suffixed with
.service. If you do decide to use another name then you will need to use this name with your systemctl commands.
hi im just looking at your bit off code and you said mono /usr/bin/mono-service
but when i start the service
Job for cumulusmx.service failed because the control process exited with error code.
See "systemctl status cumulusmx.service" and "journalctl -xe" for details.
and ive tred looking for the /usr/bin/mono-service but i cnt find it
● cumulusmx.service - CumulusMX service
Loaded: loaded (/etc/systemd/system/cumulusmx.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-01-19 12:33:44 GMT; 56s ago
Docs:
https://cumuluswiki.org/a/Main_Page
Process: 1202 ExecStart=/usr/bin/mono-service -d:/home/pi/CumulusMX CumulusMX.exe -service (code=exited, status=203/EXEC)
Process: 1203 ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock (code=exited, status=1/FAILURE)
Jan 19 12:33:44 cumulusmx systemd[1]: Starting CumulusMX service...
Jan 19 12:33:44 cumulusmx systemd[1202]: cumulusmx.service: Failed to execute command: No such file or directory
Jan 19 12:33:44 cumulusmx systemd[1202]: cumulusmx.service: Failed at step EXEC spawning /usr/bin/mono-service: No such file or directory
Jan 19 12:33:44 cumulusmx systemd[1]: cumulusmx.service: Control process exited, code=exited, status=203/EXEC
Jan 19 12:33:44 cumulusmx rm[1203]: /bin/rm: cannot remove '/tmp/CumulusMX.exe.lock': No such file or directory
Jan 19 12:33:44 cumulusmx systemd[1]: cumulusmx.service: Control process exited, code=exited, status=1/FAILURE
Jan 19 12:33:44 cumulusmx systemd[1]: cumulusmx.service: Failed with result 'exit-code'.
Jan 19 12:33:44 cumulusmx systemd[1]: Failed to start CumulusMX service.