Page 1 of 1

systemd script for CumulusMX

Posted: Mon 27 Feb 2017 11:42 am
by MJFear
Hi,

Wonder if anyone can help me please.

I have got CumulusMX up and running on a Ubuntu 16.04.2 LTS box running under VirtualBox. I have a Fine Offset WH-1081 station (actually a Maplin N96GY), so had to compile and install mono-complete 4.0.5.1 to get that to work. So far, so good, and loving CumulusMX's new look compared to Cumulus 1.

Currently, to start CumulusMX I simply do:

cd /opt/CumulusMX
sudo /opt/mono/bin/mono CumulusMX.exe

I have tried to create a systemd .service file to enable automatic starting of CumulusMX on boot. My file, which I have placed at /lib/systemd/system/cumulusmx.service is as follows:

[Unit]
Description=CumulusMX Service

[Service]
Type=forking
WorkingDirectory=/opt/CumulusMX
ExecStart=/opt/mono/bin/mono-service CumulusMX.exe
Restart=always

[Install]
WantedBy=multi-user.target

I have done 'sudo systemctl enable cumulusmx' [worked fine] and then 'sudo systemctl start cumulusmx' but this does not quite work. If I then do 'sudo systemctl status cumulusmx' I get:

\u25cf cumulusmx.service - "CumulusMX Service"
Loaded: loaded (/lib/systemd/system/cumulusmx.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2017-02-27 10:48:38 GMT; 46min ago
Main PID: 11566 (mono)
CGroup: /system.slice/cumulusmx.service
\u2514\u250011566 /opt/mono/bin/mono /opt/mono/lib/mono/4.5/mono-service.exe /opt/CumulusMX/CumulusMX.exe

Feb 27 10:48:37 ubuntu16 systemd[1]: Starting CumulusMX Service...
Feb 27 10:48:38 ubuntu16 systemd[1]: Started CumulusMX Service.
Feb 27 10:48:38 ubuntu16 mono[11566]: /opt/CumulusMX/CumulusMX.exe: Directory 'MXdiags' not found.

It looks as though I need to define the location of the 'MXdiags' subdir somehow - I had hoped that the 'Working Directory' declaration in the .service file, but doesn't look like it is working. Is there a way I can specify the location of 'MXDiags' in the 'ExecStart' line?

Grateful for any ideas anyone may have on this.

Thanks

Mark

Re: systemd script for CumulusMX

Posted: Mon 27 Feb 2017 11:45 am
by ConligWX
If I'm not mistaken was Fine Offset Stations meant to use an older version of mono with CumulusMX?

also the MXdiags folder is part of the CumulusMX install, did you copy all the files and folders from the zip file?

Personally on my Debian install I copied all the folders/files (below) to the root inside \CumulusMX\ folder

Re: systemd script for CumulusMX

Posted: Mon 27 Feb 2017 11:54 am
by MJFear
Thanks Toxic 17 - yes you are right about the mono version, that's why I had to manually compile and install mono 4.0.5.1 as neither 4.2.1 (which installs if you do 'sudo apt-get install mono-complete' or the very latest version work. I also had to find a fix to install libudev.so.0 (which I did like this http://gamblisfx.com/how-to-solve-missi ... ntu-16-04/.

The MXdiags directory is there, as I can see it and it works fine if I start the app manually.

Turns out......all I needed to do was reboot the box for some reason that I haven't yet fathomed. Possibly conflicting with the manually started version of CumulusMX (which I thought I had closed down, but maybe not).

Anyway, my script works fine, so guess we can mark this one closed!! :D

Re: systemd script for CumulusMX

Posted: Mon 27 Feb 2017 12:00 pm
by MJFear
One little adjustment to the .service file for posterity - just noticed I had tried changing the ExecStart line to include the full CumulusMX path:

ExecStart=/opt/mono/bin/mono-service /opt/CumulusMX/CumulusMX.exe

As that seems to be working, that's how I'm going to leave it!!

Re: systemd script for CumulusMX

Posted: Wed 01 Mar 2017 1:51 pm
by jank
MJFear wrote:ExecStart=/opt/mono/bin/mono-service /opt/CumulusMX/CumulusMX.exe
Yes, I can confirm, this is working and systemd is an alternative to init.d.
[Unit]
Wants=network-online.target
After=network.target network-online.target

[Service]
WorkingDirectory=/home/pi/CumulusMX
ExecStart=/usr/bin/mono /home/pi/CumulusMX/CumulusMX.exe


Unfortunately, My Start/Stop script is not working with systemd. I assume Screen will not work together when systemd is daemonizing CumulusMX.