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.
User avatar
VTHokie74
Posts: 130
Joined: Tue Apr 10, 2012 12:58 am
Weather Station: Davis Vantage Pro 2
Operating System: Rasbian
Location: Ashland, KY

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby VTHokie74 » Sun Jul 10, 2016 9:04 pm

OK, I changed the permissions all to pi and rebooted. CumulusMX started fine. Thank you my friend.

One last question. Can the DD backup directory be the same Windows share I mounted?
Station: Davis Vantage Pro 2/CumulusMX/Raspberry Pi 3

jank
Posts: 300
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 Jul 10, 2016 9:13 pm

VTHokie74 wrote:OK, I changed the permissions all to pi and rebooted. CumulusMX started fine. Thank you my friend.

One last question. Can the DD backup directory be the same Windows share I mounted?

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

User avatar
VTHokie74
Posts: 130
Joined: Tue Apr 10, 2012 12:58 am
Weather Station: Davis Vantage Pro 2
Operating System: Rasbian
Location: Ashland, KY

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby VTHokie74 » Mon Jul 11, 2016 1:22 pm

I checked this morning to see if I got any backups from the Raspberry to my Windows share folder. Nope, nothing was there. I checked the owner of the mounted directory /home/pi/windowsshare/backup and sure enough it was root. I ran chown to change the owner from root to pi and ran a backup using -b -z parameters and everything worked. I am guessing if you use sudo nano /etc/fstab to add the mount directory it sets the owner as user root even if you are logged in an SSH terminal window as user pi.
Station: Davis Vantage Pro 2/CumulusMX/Raspberry Pi 3

jank
Posts: 300
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 » Mon Jul 11, 2016 1:49 pm

I would more or less say that it is not a problem of "who created an entry in th fstab" because pi should not have rights to modify /etc/fstab ....only root sould do this.
In your case someone has created the windows share and user pi has no rights to access this windows share.
In my fstab you can see some windows (samba) shares and a nfs (linux) share.

192.168.193.3:/export/Public /mnt/Public nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
//192.168.193.3/Kerio_logs /var/log/kerio cifs username=jank,password=secret,iocharset=utf8,sec=ntlm 0 0
in bold, oyu can see that my windows share in the fstab is connecting as user: jank with the password: secret

did you have a username password in your share line ? If you here insert root and it''s password, you should run also the backup as user pi.
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

User avatar
VTHokie74
Posts: 130
Joined: Tue Apr 10, 2012 12:58 am
Weather Station: Davis Vantage Pro 2
Operating System: Rasbian
Location: Ashland, KY

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby VTHokie74 » Mon Jul 11, 2016 2:22 pm

This is what I added to the /etc/fstab file:

//routerdrive1/RaspberryPi /home/pi/routerdrive1/backup cifs username=xxxxxx,password=xxxxx,workgroup=WORKGROUP

The username and password are the router password. My network drive is connected directly to a USB port on my router and shared out to my network. "//routerdrive1/RaspberryPi" is the Windows network path for the drive and folder.

I edited the file logged in as pi using "sudo nano /etc/fstab".
Station: Davis Vantage Pro 2/CumulusMX/Raspberry Pi 3

jank
Posts: 300
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 » Mon Jul 11, 2016 6:05 pm

VTHokie74 wrote:This is what I added to the /etc/fstab file:

//routerdrive1/RaspberryPi /home/pi/routerdrive1/backup cifs username=xxxxxx,password=xxxxx,workgroup=WORKGROUP

The username and password are the router password. My network drive is connected directly to a USB port on my router and shared out to my network. "//routerdrive1/RaspberryPi" is the Windows network path for the drive and folder.
I edited the file logged in as pi using "sudo nano /etc/fstab".


Ahh okay. first of all, try: nano /etc/fstab make a change anywhere in this file (example: almost on top
#test
and try to save this file. You will see, that you are not allowed as user pi. Thats the reason, why you need to use sudo to modify such a system file.

I assume, your Router is having any SSH access ? ...and you are using root on your router to create the share //routerdrive1/RaspberryPi /home/pi/routerdrive1/backup folder ?
Try this one to change the owner of the share:
sudo chown pi:pi /home/pi/routerdrive1/backup I hope, after doing this, you are allowed to add/store/backup files to this share
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

User avatar
VTHokie74
Posts: 130
Joined: Tue Apr 10, 2012 12:58 am
Weather Station: Davis Vantage Pro 2
Operating System: Rasbian
Location: Ashland, KY

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby VTHokie74 » Mon Jul 11, 2016 7:03 pm

jank wrote:Ahh okay. first of all, try: nano /etc/fstab make a change anywhere in this file (example: almost on top
#test
and try to save this file. You will see, that you are not allowed as user pi. Thats the reason, why you need to use sudo to modify such a system file.

Correct. I opened the file with nano as pi from /home/pi and I got a a permission denied error when I attempted to save the changes.

I assume, your Router is having any SSH access ? ...and you are using root on your router to create the share //routerdrive1/RaspberryPi /home/pi/routerdrive1/backup folder ?

I am not sure about SSH. I just plugged the USB drive into a PC to access it that way. Then I created a \Raspberry\ backup folder using file manager in Windows. I plugged the drive back into the router and the folder was there. I think I could have done this through the router interface but my method worked.

Try this one to change the owner of the share:
sudo chown pi:pi /home/pi/routerdrive1/backup I hope, after doing this, you are allowed to add/store/backup files to this share


Yes, I did exactly that earlier and I can now manually backup to the external network drive with the script and the -b option. I assume the daily backups should work now also. I will check tomorrow and see if they ran.
Station: Davis Vantage Pro 2/CumulusMX/Raspberry Pi 3

jank
Posts: 300
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 » Mon Jul 11, 2016 7:10 pm

Great. Let me know if it works for you.
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

User avatar
VTHokie74
Posts: 130
Joined: Tue Apr 10, 2012 12:58 am
Weather Station: Davis Vantage Pro 2
Operating System: Rasbian
Location: Ashland, KY

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby VTHokie74 » Tue Jul 12, 2016 11:11 am

The backup worked.

I remembered I had to go back and edit the crontab. I had taken everything out when the @reboot didn't work. I added the daily and weekly backup lines back at the bottom.
Station: Davis Vantage Pro 2/CumulusMX/Raspberry Pi 3

User avatar
jpsc
Posts: 163
Joined: Tue Aug 23, 2011 6:06 pm
Weather Station: Davis Vantage Vue, belfryboy USB
Operating System: Raspbian Jessie
Location: Wye valley, Herefordshire, UK
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby jpsc » Mon Oct 17, 2016 10:52 pm

More feedback on the init.d no start.

You may recall that I had an 8GB SD Jessie Lite image that would boot and start cumulusmx and a 4GB image that would not. They were not identical but were built in the same way. I download Jessie Lite from raspbian.org and then add mono, Apache, etc. I then mount my SSD which has CumulusMX and the web server files. This way the SD card gets very little traffic, and is not subject to the corruption I regularly had when CumulusMX and data files were on it.

I have been running the 8GB image with no problems at all for the last few months (actually a clone of it on to a 16GB card because I could not find an 8GB SD with enough space) and so have not been back here at all. I have the SSD with the Pi in a Plusberry Pi case, all self contained.

I recently read of the new boot modes of the Pi3 and so bought one to experiment, hoping to eliminate the SD card entirely, booting directly from the SSD.

My first step was to build a bootable USB stick using the instructions here https://www.raspberrypi.org/blog/pi-3-booting-part-i-usb-mass-storage-boot/. I made sure I used a USB stick known to work - a Sandisk Cruzer Fit 16GB. Having cloned Jesse Lite on to it, it booted and I can now throw away my SD card (at least put it on a shelf in case of later trouble).

Next step copy the CumulusMX installation and Apache files from a temporarily mounted SSD, dismount that and get CumulusMX running from the booting USB stick - easy.

Next make another backup of CumulusMX in case, in case.

Finally repartition the SSD and clone the boot USB stick onto it.

I now have a Raspberry Pi that boots directly from SSD, no other storage media needed.


That is all very well but I found that the USB stick, and also the SSD build will not start the script at boot, just like the problems I had with the 4GB images. I am now using the -w watchdog switch in the script in crontab so can live with the startup delay.

I suppose my next move will be to clone the working 8GB SD card on to the Sandisk Cruzer Fit and see if that can be persuaded to start CumulusMX, if so it should work on the SSD. If not I will count my blessings and be happy with the current situation.


I just wanted to give my appreciation of a thoroughly good piece of work, and to show where it has got me.
John Cooper

Cumulus MX on RPi3 with SSD

http://weather.mountpleasanthouse.uk

Image

jank
Posts: 300
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 » Wed Oct 19, 2016 7:37 am

jpsc wrote:More feedback on the init.d no start.You may recall that I had an 8GB SD Jessie Lite image that would boot and start cumulusmx

Yes, I recall and I already downloaded your SD Card image but had not the time trying it out......
jpsc wrote:I now have a Raspberry Pi that boots directly from SSD, no other storage media needed.

Wow, thats great and this might be the very best way to start a Reaspberry. But also using a SD Card just for the Boot process is good enough, because only a few files are being used during the boot (root is on SSD) and this will not damage a SD Card....for decades :-)
jpsc wrote:That is all very well but I found that the USB stick, and also the SSD build will not start the script at boot, just like the problems I had with the 4GB images. I am now using the -w watchdog switch in the script in crontab so can live with the startup delay.
I suppose my next move will be to clone the working 8GB SD card on to the Sandisk Cruzer Fit and see if that can be persuaded to start CumulusMX, if so it should work on the SSD. If not I will count my blessings and be happy with the current situation.
I just wanted to give my appreciation of a thoroughly good piece of work, and to show where it has got me.

thank you very much, but our goal should be, that the CumulusMX can start at system boot like all other deamons which are located in /etc/init.d, right?
OKay, you always cloned your installation form a USB/SSD/SD which not starts the CumulusMX init.d script....you never installed a new system? So you always cloned the error, or am I wrong?
My first impression when you used 2 devices (SD to boot and USB /SSD to work from) was, that the second device was not ready when the Script tried to start CumulusMX but this should not be the case when only 1 disc is being used......
But can you try this recommendation I mentioned in this post? ---> http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767&start=330#p120756 Maybe the init Script is not correctly linked into the runlevels......Can you try using chkconfig command ?
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

jank
Posts: 300
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 Feb 12, 2017 3:46 pm

Today, after more then 200 days uptime, a network outage caused my Raspberry Pi to hang so I needed to reboot and once it came up again, the CumulusMX was not started by the init.d script.
After some minutes I found out, that the /etc/init.d/cumulusmx was set to run as user pi
CumulusMX_USER=pi

but since some files in the /CumulusMX Installation folder changed the ownership for any reason, the init.d script won't work anymore.

After changing the ownership for all files in the CumulusMX Installation folder back to pi, everything worked after the next reboot
sudo chown -R pi:pi /home/pi/CumulusMX

Maybe this was a reason, why some of you had no luck to get CumulusMX started when system starts?
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: 276
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 Feb 12, 2017 11:26 pm

some files keeps changing the ownership so I keep having to do it every now and then.
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: 300
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 » Mon Feb 13, 2017 1:16 pm

Hello Richard
I am not 100% sure, but from time to time, I am also unsure, if soemthing has changed the ownership of one file. I thought I am 100% that I run CumulusMX as user pi, but weeks later, when I am trying to restart, it says that some files have changed the ownership.

I am sure, you know the commands to test it ?

Test 1. Check the owner ship of all files in the cumulusMX Dir ----> find /home/pi/CumulusMX/ -type f -printf "%u \n" |sort |uniq
Change the path in case it is installed somewhere else
If you see only 1 username, for xmaple pi, you can check it by using this command

Test 2- Check if the query is working: sudo touch /home/pi/CumulusMX/test test
Run command again: find /home/pi/CumulusMX/ -type f -printf "%u \n" |sort |uniq
You should see 2 usernames now
Delete file test ---> sudo rm /home/pi/CumulusMX/test

To test who's the owner of the PID file: stat -c %U /tmp/CumulusMX.pid

If you now see days later, that an owner of a file has changed, use the stat command.
Example: If the owner of the file test has changed: stat /home/pi/CumulusMX/test

This command will give you at least an information about any changes of the file....

I will do the same on my pi, but after 24 hours, all files still belong to user pi.
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

BigOkie
Posts: 211
Joined: Tue May 28, 2013 1:06 am
Weather Station: Davis VP2
Operating System: Raspian Jessie
Location: Tulsa, OK

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby BigOkie » Mon Feb 13, 2017 2:00 pm

jank wrote:Today, after more then 200 days uptime, a network outage caused my Raspberry Pi to hang so I needed to reboot and once it came up again, the CumulusMX was not started by the init.d script.
After some minutes I found out, that the /etc/init.d/cumulusmx was set to run as user pi
CumulusMX_USER=pi

but since some files in the /CumulusMX Installation folder changed the ownership for any reason, the init.d script won't work anymore.

After changing the ownership for all files in the CumulusMX Installation folder back to pi, everything worked after the next reboot
sudo chown -R pi:pi /home/pi/CumulusMX

Maybe this was a reason, why some of you had no luck to get CumulusMX started when system starts?


when I implemented mine, that was one of the first things I changed.

However, on a subsequent reboot (which happened in much the same manner as yours did) it didn't start.

Wasn't understanding why until I installed chkconfig and noticed that the cumulusmx script was not set to start as evidenced by issuing the command chkconfig | grep cumulusmx and the result returned 'cumulusmx off'.

I believe running 'update-rc.d cumulusmx defaults', then running 'update-rc.d cumulusmx enable' solved that issue.


Return to “Cumulus MX”

Who is online

Users browsing this forum: freddie and 6 guests