Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

systemd script for CumulusMX

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
MJFear
Posts: 5
Joined: Mon Nov 21, 2016 10:43 am
Weather Station: Maplin N96GY
Operating System: CentOS 6

systemd script for CumulusMX

Postby MJFear » Mon Feb 27, 2017 11:42 am

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

User avatar
Toxic17
Posts: 678
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis VPro2 Plus
Operating System: Debian 9.5 Stretch
Location: Bangor, NI
Contact:

Re: systemd script for CumulusMX

Postby Toxic17 » Mon Feb 27, 2017 11:45 am

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
You do not have the required permissions to view the files attached to this post.
Regards Simon

https://www.conligwx.org
https://www.conligwx.org/pws/
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

MJFear
Posts: 5
Joined: Mon Nov 21, 2016 10:43 am
Weather Station: Maplin N96GY
Operating System: CentOS 6

Re: systemd script for CumulusMX

Postby MJFear » Mon Feb 27, 2017 11:54 am

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-missing-libudev-so-0-library-on-ubuntu-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

MJFear
Posts: 5
Joined: Mon Nov 21, 2016 10:43 am
Weather Station: Maplin N96GY
Operating System: CentOS 6

Re: systemd script for CumulusMX

Postby MJFear » Mon Feb 27, 2017 12:00 pm

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!!

jank
Posts: 302
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: systemd script for CumulusMX

Postby jank » Wed Mar 01, 2017 1:51 pm

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.
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767


Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 1 guest