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 4019) - 03 April 2024

Legacy Cumulus 1 release 1.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: 5968
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

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

Post by HansR »

Yes, I have been using that a long time. But never for the backup. I have my own daily backup script which sends the whole Cumulus directory tree to the NAS and once a week I make a complete image backup.

I used it only for start/stop/status, rarely did a restart.

I wanted an automatic reboot possibility, so when the CMX daemon facility was there, it was time to switch to the cumulusmx.sh delivered with CMX.
Now with the systemd it is similar and I just have to change the stop/start commands in the backup procedure.

So it was not a direct move, but yes I went from the start/stop script to the deamon start/stop.

BTW: that may be goodbye to the start/stop script, but applause for @jank because it saved a lot of trouble :clap:
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
freddie
Posts: 2479
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 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.
I'm pretty sure you can't define your own verbs/commands, and you can't alter the output of the status command. But there is always the show command which displays the properties of the unit. It may be possible to populate a custom property with the output from the console file and then do:

Code: Select all

systemctl show cumulusmx | grep yourpropertyname
but it does seem a bit clumsy, and is just as easy to type (or create an alias to):

Code: Select all

cat $MX_INSTALL/MXdiags/ServiceConsoleLog.txt
after the service has started.
Freddie
Image
freddie
Posts: 2479
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 »

ConligWX wrote: Sat 29 Aug 2020 4:37 pm handy to do a backup, restart, stop, start, update etc. now if the systemd could do all that...... well.
You could always create your own systemd units for backup and update, and cause those units to call restart on the MX unit.
Freddie
Image
jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

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

Post by jlmr731 »

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


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?
Now I know its been said that there is a log file in MXdiag you can tail to see, but a thought on a systemd, or init.d script (either system should do this) to be able to pull up the console to see like if we ran it from the prompt. Using screen will allow you to pull that up, with an systemd script it can be as simple as adding this

Code: Select all

ExecStart=/usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service
##change too
ExecStart=/usr/bin/screen -dmfa -S Cumulus /usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service
Now this IS TOTALY UNTESTED
you can then

Code: Select all

screen -r Cumulus
to pull it up

It can also be done with init.d if someone what to translate that to a working script

Just my thought on it, Ill give it a try this next weekend when i have time
User avatar
HansR
Posts: 5968
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

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

Post by HansR »

jlmr731 wrote: Mon 31 Aug 2020 2:10 am Using screen will allow you to pull that up, with an systemd script it can be as simple as adding this
Personally, I think this is just full circle going back to where we were, kind of retrograde.
So, no, this is not for me.

Nice to know it is possible in systemd though ;)
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
freddie
Posts: 2479
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 »

jlmr731 wrote: Mon 31 Aug 2020 2:10 am
HansR wrote: Sat 29 Aug 2020 3:59 pm @freddie:


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?
Now I know its been said that there is a log file in MXdiag you can tail to see, but a thought on a systemd, or init.d script (either system should do this) to be able to pull up the console to see like if we ran it from the prompt. Using screen will allow you to pull that up, with an systemd script it can be as simple as adding this

Code: Select all

ExecStart=/usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service
##change too
ExecStart=/usr/bin/screen -dmfa -S Cumulus /usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service
I can't see this working. If you start CumulusMX as a service, there is no output in the terminal in which you start it. When running MX as a service, terminal output is redirected to the file MXdiags/ServiceConsoleLog.txt. Therefore if you use screen in your startup command and do

Code: Select all

screen -r
to reattach to the screen, then you will just see a blank terminal screen.
Freddie
Image
jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

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

Post by jlmr731 »

Not sure what you will see but im thinking that you should see all the start up till normal running then any errors that come across. Is it needed NO it was just in response to a a post where there might be a need to see console output. I have yet to set it up so not even sure what is outputted to the log file and if just stdout > then screen would do the same so yes redundant, or does the log file include any other actions that happen, guess its just im used to seeing the term up and if no errors have been broadcasted i know everything is fine.
I use screen alot just so i dont have many terminal windows open and can quickly switch around.
freddie
Posts: 2479
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 »

My point is that you are starting Cumulus as a mono service and there isn't any terminal output when you do this without screen - it is redirected (both stdout and stderr) to the log file. So if you start it using screen you won't see any output on startup either (as it has been redirected to a file), nor when you re-attach to your screen.
Freddie
Image
User avatar
mcrossley
Posts: 12771
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 »

Thanks @Freddie, I'll add this file to the distribution, and remove the init.d script.
User avatar
dazza1223
Posts: 867
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

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

Post by dazza1223 »

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:

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.
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.
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
freddie
Posts: 2479
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 »

mono-service is correct. What version of mono do you have installed, and did you install the mono-complete package?
Freddie
Image
User avatar
dazza1223
Posts: 867
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

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

Post by dazza1223 »

Mono JIT compiler version 6.12.0.107 (tarball Thu Dec 10 05:44:54 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp+hard
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: preemptive
GC: sgen (concurrent by default)
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
User avatar
dazza1223
Posts: 867
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

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

Post by dazza1223 »

and i got the mono infor

sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update


then run this sudo apt install mono-devel

https://cumuluswiki.org/a/Setting_up_Raspberry_Pi
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
freddie
Posts: 2479
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 - not mono-devel - that is the problem. Uninstall mono-devel and install mono-complete
Freddie
Image
freddie
Posts: 2479
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 »

It specifically mentions mono-complete in this article.
Freddie
Image
Post Reply