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

RaspberryPi: CumulusMX init.d System Startup Script

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

RaspberryPi: CumulusMX init.d System Startup Script

Postby jank » Thu Jan 07, 2016 3:27 pm

This tuorial affects all people having a Raspberry Pi running CumulusMX in conjunction with the CumulusMX Start|Stop Script
mentioned in post http://sandaysoft.com/forum/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 Oct 11, 2016 11:53 am, edited 15 times in total.
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

txweather
Posts: 36
Joined: Sun Jan 03, 2016 10:27 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian
Location: Spring, TX
Contact:

Re: RaspberryPi: CumulusMX startup at System Boot Script

Postby txweather » Fri Jan 08, 2016 12:37 am

Thanks. Ill give this a spin tonight.
Will report back.

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

Re: RaspberryPi: CumulusMX startup at System Boot Script

Postby jank » Fri Jan 08, 2016 6:57 am

Looking forward for your reply
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

txweather
Posts: 36
Joined: Sun Jan 03, 2016 10:27 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian
Location: Spring, TX
Contact:

Re: RaspberryPi: CumulusMX startup at System Boot Script

Postby txweather » Sat Jan 09, 2016 3:33 pm

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: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi: CumulusMX startup at System Boot Script

Postby jank » Sat Jan 09, 2016 4:18 pm

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

prrescue
Posts: 8
Joined: Sun Jun 07, 2015 5:45 pm
Weather Station: DavisVantage VUE
Operating System: Windows 7
Location: Puerto Rico

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby prrescue » Sun Jan 10, 2016 4:32 am

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: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby jank » Sun Jan 10, 2016 10:46 am

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

prrescue
Posts: 8
Joined: Sun Jun 07, 2015 5:45 pm
Weather Station: DavisVantage VUE
Operating System: Windows 7
Location: Puerto Rico

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby prrescue » Sun Jan 10, 2016 7:51 pm

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: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby jank » Sun Jan 10, 2016 9:37 pm

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

peter94506
Posts: 15
Joined: Fri Feb 24, 2012 9:04 pm
Weather Station: wrm100n
Operating System: win 7
Location: usa

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby peter94506 » Sun Jan 17, 2016 7:00 pm

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: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby jank » Sun Jan 17, 2016 7:22 pm

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

richard_newberry
Posts: 265
Joined: Tue Apr 12, 2011 10:23 pm
Weather Station: Watson W-8186
Operating System: Debian Stretch (VMWARE Esxi 6.5)
Location: Leicester
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby richard_newberry » Sun Jan 17, 2016 7:36 pm

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
http://www.desford-weather.co.uk
http://desford-weather.co.uk
Also on Desford weather underground.
Looking forward to cumulus on Linux platform it'll rock!!

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

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby jank » Sun Jan 17, 2016 8:04 pm

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

richard_newberry
Posts: 265
Joined: Tue Apr 12, 2011 10:23 pm
Weather Station: Watson W-8186
Operating System: Debian Stretch (VMWARE Esxi 6.5)
Location: Leicester
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby richard_newberry » Sun Jan 17, 2016 8:08 pm

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
http://www.desford-weather.co.uk
http://desford-weather.co.uk
Also on Desford weather underground.
Looking forward to cumulus on Linux platform it'll rock!!

peter94506
Posts: 15
Joined: Fri Feb 24, 2012 9:04 pm
Weather Station: wrm100n
Operating System: win 7
Location: usa

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby peter94506 » Sun Jan 17, 2016 9:48 pm

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.


Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 7 guests