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

RaspberryPi: CumulusMX init.d System Startup Script

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

Post Reply
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

RaspberryPi: CumulusMX init.d System Startup Script

Post by jank »

This tuorial affects all people having a Raspberry Pi running CumulusMX in conjunction with the CumulusMX Start|Stop Script
mentioned in post https://cumulus.hosiene.co.uk/viewtopic.php?f=27&t=13767


In Debian 7 (Debian Wheezy) it was not a problem at all to insert a line into the system Crontab to start a bash script at reboot using the @reboot option in a cronjob, for example:
sudo crontab -e

Code: Select all

@reboot  sudo /home/pi/CumulusMX/cumulusmx.sh >> /dev/null 2>&1
For any reason people reported that they are having problems using this method in Debian 8 (Debian Jessie)
I was able to insert such a command in the system crontab successfully, but others reported further problems
sudo nano /etc/crontab

Code: Select all

@reboot        pi      /home/pi/CumulusMX/cumulusmx.sh >> /dev/null 2>&1
This was the reason why I created a small system startup script which can be placed in /etc/init.d to start the CumulusMX Start|Stop Script at system boot without irritate with cron jobs probably not working anymore

Here is the instruction what you need to do.

1. Removing autostarts from cron
You can ignore this step, if you never had a cron based startup entry and proceed with Step 2
Please make sure, that all cron's are being checked not to start cumulusmx.sh anymore
Please use these commands and search for lines probably containing the start|stop script at reboot

crontab -e
sudo crontab -e
sudo nano /etc/crontab

Code: Select all

@reboot /home/pi/CumulusMX/cumulusmx.sh
If present, change them to

Code: Select all

#@reboot /home/pi/CumulusMX/cumulusmx.sh
2. Download the /etc/init.d script
cumulusmx.zip
Copy the Script (using WINSCP) to your /tmp folder
Once the zip file is copied, login as pi or root using SSH (Putty) and insert these commands
unzip /tmp/cumulusmx.zip - will unzip the zip file
sudo cp /tmp/cumulusmx /etc/init.d/cumulusmx - will copy the startup script cumulusmx to /etc/init.d
sudo chmod +x /etc/init.d/cumulusmx - will make the scirpt executable
sudo update-rc.d cumulusmx defaults - will insert the Startup Script into the runlevels
(the command to remove it from the runlevels again is: sudo update-rc.d -f cumulusmx remove)

3. Changing some settings in this init script
sudo nano /etc/init.d/cumulusmx

Please only change one of these lines if necesarry (for most poeple nothing needs to be changed)

Code: Select all

CumulusMX_HOME=/home/pi/CumulusMX
CumulusMX_USER=root
CumulusMX_HOME= the folder where the cumulusmx.sh Start|Stop Script is located. Normally it is in the same folder as CumulusMX.exe
CumulusMX_USER this is the user, who should start CumulusMX at system boot. It might user pi or root
Save changes by pressing CTRL-o and CTRL-x
sudo reboot - to reboot system

After the system has being rebooted check if CumulusMX is being started.
sudo grep -i cumulusmx /var/log/syslog
you should see a line like this:
Jan 7 13:31:11 raspberrypi systemd[1]: Started LSB: Start cumulusmx.sh (CumulusMX) at boot time

But now you have more options
type: /etc/init.d/cumulusmx
Usage: /etc/init.d/cumulusmx {start|stop|force-reload|status}
Possible commands should be

/etc/init.d/cumulusmx stop
/etc/init.d/cumulusmx start
/etc/init.d/cumulusmx force-reload
/etc/init.d/cumulusmx status

I think I don't need to explain these commands

So you are free to start stop CumulusMX by using the start Stop Script itself
1) /home/pi/CumulusMX/cumulusmx.sh -{options}
or using
2) /etc/init.d/cumulusmx {options}

however option 1) has more options than option 2)

for me it works so feel free to play around wit this init script.
I know, real linux admins maybe can do this much better then me, but this was my first attempt to write a init.d script.

EDIT: 11.10.2016
For all who have trouble strating CumulusMX with the init.d Startup Script at system boot, here is a command to check, if the init.d startup scirpt is correctly inserted into the runlevel of your system.
1) install a small program called: chkconfig
sudo apt-get install chkconfig
2) run the command to check if the startup script should be started at system boot
chkconfig |grep cumu
as a result you should see:

cumulusmx on

If you did not see this result, you missed to enter the following command to insert the startup script into the runlevels

sudo update-rc.d cumulusmx defaults
You do not have the required permissions to view the files attached to this post.
Last edited by jank on Tue 11 Oct 2016 11:53 am, edited 15 times in total.
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
txweather
Posts: 36
Joined: Sun 03 Jan 2016 10:27 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian
Location: Spring, TX
Contact:

Re: RaspberryPi: CumulusMX startup at System Boot Script

Post by txweather »

Thanks. Ill give this a spin tonight.
Will report back.
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX startup at System Boot Script

Post by jank »

Looking forward for your reply
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
txweather
Posts: 36
Joined: Sun 03 Jan 2016 10:27 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian
Location: Spring, TX
Contact:

Re: RaspberryPi: CumulusMX startup at System Boot Script

Post by txweather »

jank wrote:Looking forward for your reply
Sorry I have not been able to get to this.
I am relocating my whole weather equipment today so we should know today if it worked on debian 8.
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX startup at System Boot Script

Post by jank »

txweather wrote:
jank wrote:Looking forward for your reply
Sorry I have not been able to get to this.
I am relocating my whole weather equipment today so we should know today if it worked on debian 8.
No problem, take your time
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
prrescue
Posts: 8
Joined: Sun 07 Jun 2015 5:45 pm
Weather Station: DavisVantage VUE
Operating System: Windows 7
Location: Puerto Rico

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by prrescue »

Did not work for me, also, on the unzip of your instructions it should be unzip tmp/cumulusmx.zip

See attached
You do not have the required permissions to view the files attached to this post.
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by jank »

Hello prrescue

The error in the documentation is fixed...this was easy :-)
the bigger problem seem to be that it is not workiong for you.

In the screenshot, I can see that you tried it with the CRON method.
If you look into your screenshot, 6 January 17:33 cron is reporting (root) CMD (sudo /CumulusMX/cumulusmx.sh >> /dev/null)
But this seem not to be your path to the CumulusMX folder, becasue the Enviroment check some line above is saying that CumulusMX is installed in /home/pi/CumulusMX folder

Also the errors at 10 January 00:12:21 when it is being started with the init.d script the error is:
systemd[1]: [/lib/systemd/system/cumulus.service:5] Executable path is not absolute, ignoring: sudo ./CumulusMX/cumulusmx.sh

Unfortunately, I have no idea which version of my CumulusMX Start|Stop Script you are using. but I remember, that I had a previous version of my script online, where I had my path hardcoded instead of using variables. this was some month ago and I replaced this script version with a correct one after one day.
So I have no Idea, where you get this path from: /CumulusMX/cumulusmx.sh but it looks like this is not your installation path.
PLease do the following: can you please doublecheck the init script for the path in the top area of the script ?
What is the path for CumulusMX_HOME= ?
you can use this command
grep "CumulusMX_HOME=" /etc/init.d/cumulusmx
In your case it should be CumulusMX_HOME=/home/pi/CumulusMX
Can you also tell me which version of the CumulusMX Start|Stop Script you are using ?
/home/pi/CumulusMX/cumulusmx.sh -v
Maybe you have one of the buggy version where my hardcoded path is in there.
also the result output from this command would help me:
grep "CumulusMX/cumulusmx.sh" /home/pi/CumulusMX/cumulusmx.sh

jan
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
prrescue
Posts: 8
Joined: Sun 07 Jun 2015 5:45 pm
Weather Station: DavisVantage VUE
Operating System: Windows 7
Location: Puerto Rico

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by prrescue »

Hi,

Thanks for the script and help, its working now!! :clap:

Script Version 2.4.0.1 (2015-12-23)
CumulusNow 1.3
CumulusMX 3.0.0 Build 3036

# @reboot sudo /CumulusMX/cumulusmx.sh >> /dev/null 2>1

what i change was the fallowing

sudo nano /etc/rc.local and change sudo /etc/init.d/cumulusmx start to /etc/init.d/cumulusmx force-reload, since the "start" did not work either without the sudo on my case.
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by jank »

Hello prrescue

I have no idea what you did, or what you did with /etc/rc.local.
/etc/init.d is a directory where you can put scripts wich are able to start/stop/ Programs or in my case other scripts.
It is a kind of autostart with the difference that you can tell the Linux system when these programs should be started or stopped.
Normally, you need to put this script into this folder make some basic settings like, folder of the start|stop script and user who should start the Start|Stop Script.
Once this is done, you need to tell the system at which runlevel the Start|Stop Script should be started at system boot (sudo update-rc.d cumulusmx defaults)
So there is no need to modify /etc/rc.local which has nothing to do with /etc/init.d
However, when you are okay as it is, fine.....and if this solved the problem with the not working cron starts....great
Thanks for using it.
JAn
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
peter94506
Posts: 13
Joined: Fri 24 Feb 2012 9:04 pm
Weather Station: wrm100n
Operating System: win 7
Location: usa

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by peter94506 »

Well, i've tried about every method suggested in the forum to get CumulusMX to start on a reboot, but nothing has worked thus far. I tried the method in this thread and after reboot
sudo grep -i cumulusmx /var/log/syslog looks as it should but CumulusMX never seems to start. When I sudo ./CumulusMX.sh manually, then it starts CumulusMX and things run as normal. It is an important thing to be able to automatically start CumulusMX on a reboot as the power goes out here on a regular basis.

any other ideas?
You do not have the required permissions to view the files attached to this post.
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by jank »

Can you please have a Look at the /etc/init.d/cumulusmx. For These 2 Lines?

CumulusMX_HOME=/home/pi/CumulusMX
CumulusMX_USER=root


Is it the Same in your File?
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
richard_newberry
Posts: 481
Joined: Tue 12 Apr 2011 10:23 pm
Weather Station: Watson W-8186
Operating System: Raspbian Bookworm & Debian 12
Location: Leicester
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by richard_newberry »

It shouldnt be as 'root' should be the user that cumulusmx is installed on.

Root is a very powerful user. Only used to install software and other system base stuff.
Desford Weather (at parents)
https://desford-weather.co.uk

Countesthorpe Weather (at mine)
https://countesthorpe-weather.co.uk
jank
Posts: 239
Joined: Sat 13 Jun 2015 5:57 pm
Weather Station: FineOffset WS3080
Operating System: Debian Buster - Raspbian - Raspb
Location: Germany - nearby Kassel

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by jank »

Richard, you are abolutely right but:

If they decided to start CumulusMX with sudo, the owner of many files in this CumulusMX folder is user root.
When they now try to start the Script at boot time as user pi, this user might not have enough rights to write into some files, which are being created/modified when called as sudo.
Most users are starting the script with sudo with the result, that the owner of all files is root.
When they now want to use the init.d script, they also need to start it as root --> CumulusMX_USER=root

Alternatively, they can call the script as ./cumulusmx.sh without sudo and they were told that they have to change permissions first, when calling without sudo.
Then, they are able to start the script again without using sudo and using CumulusMX_USER=pi in the init.d script from now on.

But first, the permissions needs to be corrected.
Jan
Do want a Managing Dashboard for CumulusMX on RaspberryPi? cumulusmx.sh
viewtopic.php?f=40&t=17907
Image
richard_newberry
Posts: 481
Joined: Tue 12 Apr 2011 10:23 pm
Weather Station: Watson W-8186
Operating System: Raspbian Bookworm & Debian 12
Location: Leicester
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by richard_newberry »

All my files have owner of user cumulus by using chown -R cumulus:cumulus /home/cumulus/CumulusMX everything in that folder is the owner of user 'cumulus' and it works.
Desford Weather (at parents)
https://desford-weather.co.uk

Countesthorpe Weather (at mine)
https://countesthorpe-weather.co.uk
peter94506
Posts: 13
Joined: Fri 24 Feb 2012 9:04 pm
Weather Station: wrm100n
Operating System: win 7
Location: usa

Re: RaspberryPi: CumulusMX init.d System Startup Script

Post by peter94506 »

jank wrote:Can you please have a Look at the /etc/init.d/cumulusmx. For These 2 Lines?

CumulusMX_HOME=/home/pi/CumulusMX
CumulusMX_USER=root


Is it the Same in your File?


yes, it's the same, I also tried it with pi user.
Post Reply