Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Cumulus as a server - start/stop through init.d

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Cumulus as a server - start/stop through init.d

Post by HansR »

I did:

Code: Select all

update-rc.d mono-xsp4 disable
Thinking xsp4 was not required (I think it isn't because manual start afterwards makes CumulusMX run fine).

Apparently this also disables the start of cumulus during a reboot as well. I simply had added cumulusmx.sh to the init.d directory and everything worked fine but at the deactivation of xsp4 it also deactivates cumulus. When reactivating xsp4 I get:
    Aantekening 2020-08-28 072727.png
      Before starting to mess things up: what is going on here, not being an init.d specialist?

      When I start cumulus manually by

      Code: Select all

      /etc/init.d/cumulusmx.sh start
      everything is OK, but I am missing the automatic start/stop by init.d

      I think - as far as I researched this - the cumulus-script for Linux/Debian needs to comply to LSBInitScripts.
      (other OSs on RPi are on their own I guess)
      You do not have the required permissions to view the files attached to this post.
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      The issue here is that init.d is deprecated and has been for quite a while. systemd is the replacement, and it is good practice to tailor control scripts for this environment. systemd has been adopted by most if not all flavours of Linux for about 5 years now.
      Freddie
      Image
      User avatar
      HansR
      Posts: 5871
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by HansR »

      So, what's the instruction for CumulusMX then?
      (as btw everything including mono, starts via init.d)
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      No, systemd starts everything, and those things that haven't been updated from init.d are included in that via an adaptor. It's much better to use systemd natively. There are plenty of resources online covering it. If I get a minute on Saturday I will put something together.
      Freddie
      Image
      User avatar
      HansR
      Posts: 5871
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by HansR »

      freddie wrote: Fri 28 Aug 2020 7:41 am No, systemd starts everything, and those things that haven't been updated from init.d are included in that via an adaptor.
      I can't see any of that on my (pretty much default) install of Raspbian Buster.
      freddie wrote: Fri 28 Aug 2020 7:41 am There are plenty of resources online covering it. If I get a minute on Saturday I will put something together.
      Would appreciate that.
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      Freddie
      Image
      User avatar
      rogerthn
      Posts: 489
      Joined: Thu 11 Apr 2013 6:31 pm
      Weather Station: Ecowitt GW1000/GW1003
      Operating System: Raspberry Pi OS bullseye aarch64
      Location: Trollhättan Sweden
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by rogerthn »

      HansR wrote: Fri 28 Aug 2020 7:58 am I can't see any of that on my (pretty much default) install of Raspbian Buster.
      Hans, please try ;)

      Code: Select all

      systemctl list-units
      and

      Code: Select all

      ls -l /lib/systemd/system/
      Image
      User avatar
      HansR
      Posts: 5871
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by HansR »

      Thanks for the info guys, a bit late because I was updating my OS and that was a large update.
      Thnx @rogerthn for the commands. The second I had already found just searching the directories.

      Though there may have been some confusion about init and systemd, it was clear to me that it was not a System V ini which ruled. But it is also clear that there are many init.d scripts in the system and they are executed by systemd, though I was not aware of the wrapper doing that. What the roger-commands show is that that is the system booting, not user programs running as a deamon.

      OK, whatever the situation is: the init.d scripts are still executed.

      And that means my starting message is valid: the script as supplied by Mark in the CMX distribution requires LSB tags. That's what the system is saying. I don't know what it takes to make a systemd native start/stop of CMX (I am curious what freddie comes up with), but the init.d mod seems understandable, easy and quick. And perfectly legal within the whole initialisation of the systemd.

      I think it is up to @mcrossley to decide how to do this, but as a user I require a simple script to start/stop CMX both at reboot/shutdown as well as manually. If that goes through systemctl - fine. If it is a script in init.d - fine. As long as it is non-confusing and understandable for just plain not so technical users as well: don't make this a system manager issue.

      Cheers, Hans
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      User avatar
      mcrossley
      Posts: 12694
      Joined: Thu 07 Jan 2010 9:44 pm
      Weather Station: Davis VP2/WLL
      Operating System: Bullseye Lite rPi
      Location: Wilmslow, Cheshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by mcrossley »

      All this is outside my knowledge area, if someone can come up with an improved init.d script, or a systemd solution, then I'm more than happy to replace what I knocked up!
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      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:

      Code: Select all

      systemctl daemon-reload
      There is no need to do this when you first create the unit file.

      To have Cumulus start on reboot, issue the following command:

      Code: Select all

      systemctl enable cumulusmx
      Finally, to stop the service running on reboot, use the following:

      Code: Select all

      systemctl disable cumulusmx
      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.
      Freddie
      Image
      User avatar
      HansR
      Posts: 5871
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by HansR »

      @freddie:

      Thnx. Looks good. Tried it (adjustment for path) and works for all commands.

      The status command is satisfactory.
      We only now must know where to find the console output and how to read it. Can that be done through the systemctl as well?

      Had some questions but upon implementation they disappeared. Afaiac this may be the solution to start/stop for CumulusMX. Only the cumulusmx.service file needs to be in the distribution with a small instruction (where to put and to adjust the CumulusMX path).
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      HansR wrote: Sat 29 Aug 2020 3:59 pm @freddie:

      Thnx. Looks good. Tried it (adjustment for path) and works for all commands.
      Fab. Thanks for trying it.
      HansR wrote: Sat 29 Aug 2020 3:59 pm We only now must know where to find the console output and how to read it. Can that be done through the systemctl as well?
      It is in the MXdiags folder - I forget the file name. Mark mentioned it in his release posting, so I guess the setting is internal to the application.
      Freddie
      Image
      freddie
      Posts: 2434
      Joined: Wed 08 Jun 2011 11:19 am
      Weather Station: Davis Vantage Pro 2 + Ecowitt
      Operating System: GNU/Linux Ubuntu 22.04 LXC
      Location: Alcaston, Shropshire, UK
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by freddie »

      From the 3.8.0 release notes:
      When running as a service the normal console output is logged to a file: \MXdiags\ServiceConsoleLog.txt
      Freddie
      Image
      User avatar
      HansR
      Posts: 5871
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by HansR »

      freddie wrote: Sat 29 Aug 2020 4:09 pm It is in the MXdiags folder - I forget the file name. Mark mentioned it in his release posting, so I guess the setting is internal to the application.
      Yes, I know and easy enough to get, was just wondering if you could get it after the status command as a kind of extension. Or maybe even a [selfmade] command of its own: showconsole. Or is this too demanding?

      Never mind. As is is good enough I think.
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      User avatar
      ConligWX
      Posts: 1571
      Joined: Mon 19 May 2014 10:45 pm
      Weather Station: Davis vPro2+ w/DFARS + AirLink
      Operating System: Ubuntu 22.04 LTS
      Location: Bangor, NI
      Contact:

      Re: Cumulus as a server - start/stop through init.d

      Post by ConligWX »

      HansR wrote: Sat 29 Aug 2020 4:25 pm
      freddie wrote: Sat 29 Aug 2020 4:09 pm It is in the MXdiags folder - I forget the file name. Mark mentioned it in his release posting, so I guess the setting is internal to the application.
      Yes, I know and easy enough to get, was just wondering if you could get it after the status command as a kind of extension. Or maybe even a [selfmade] command of its own: showconsole. Or is this too demanding?

      Never mind. As is is good enough I think.
      Just curious Hans, were you running the CumulusMX Start|Stop - Management Script(s) for RaspberryPi/Linux Systems" script before you moved to systemd?

      I am still running this on my Ubuntu, handy to do a backup, restart, stop, start, update etc. now if the systemd could do all that...... well.
      Regards Simon

      https://www.conligwx.org - @conligwx
      Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

      Image
      Post Reply