IMPORTANT! The server may go down soon - possibly permanently. Please read the latest post in Announcements and News

FTP is broken. I advise all users using my server for their web site to make alternative arrangements.

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: 303
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 Jan 18, 2016 2:12 pm

richard_newberry wrote: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.


Hell richard
This is the best, in my oppinion. since the last version of my script, CumulusMX can be alternatively started as a non root user, for exmaple pi.

As I already mentioned, a mixed environemtn is not recommeneded. You nned to decide to use user pi or sudo.
when you try to start the ./cumulusmx.sh -s without sudo, you are starting the Scirpt and CumulusMX as the same user as you logged in. If you have started the Script with sudo before, you will get a warning message like this
1. sudo ./cumulusmx.sh -q (this will quit CumulusMX
2. ./cumulusmx.sh (to start CumulusMX as a normal user pi)
you will see this warning:

You are running CumulusMX not as root (sudo) but as user: pi - but I found files in /home/pi/CumulusMX/ which are having different owners
pi
root
This probably happened because this Script was previously started with sudo and now without sudo.
This might cause trouble, because of <Permission Denied> problems to read and write files.
Please fix this problem by using this command: sudo chown -R pi:pi /home/pi/CumulusMX/
This will change the owner of all files in /home/pi/CumulusMX/ to owner: pi

If you want to check the files and owners by yourself, please use this command:
sudo find /home/pi/CumulusMX/ -type f -printf '%u %p\n' |sort |more


you can now use this command, to list the file in CumulusMX/ folder hwich are not writeable by user pi
sudo find /home/pi/CumulusMX/ -type f -printf '%u %p\n' |sort |more
So before the script will start again, the onwership of all filesshould be set correctly.
If you decide ton conitnue woth sudo, it is okay as it is
But if you decide to work as user pi form now on, you need to set the ownershiup correctly by using this command
sudo chown -R pi:pi /home/pi/CumulusMX/

Form this moment, the init.d script should also be changed to (sudo nano /etc/init.d/cumulusmx)
CumulusMX_USER=pi
At reboot, CumulusMX will be started by user pi form now on.

If you dedcided to use always sudo to work with CumulusMX and but changed the /etc/init.d script to start as pi, it will not worlk and the script will terminate with the error messae above. But since the Script is being started at system boot, it can not display any error messages.

However richard, can you confirm, that the /etc/init.d script is starting on your RaspberryPi ?
Until now, I have only 3 own devices where I tested it successfully.
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: 303
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 Jan 18, 2016 2:43 pm

peter94506 wrote:
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.


I checked the output of syslog and finally, cumulusmx is bein started at system byt using the init.d
This only means, that the Script cumulusmx.sh is bein started.
My quesiton: are oyu 100% sure, that cumulusmx.sh is not being started by any workign cronjob anymore ?
please check
1. cronatb -e
2. sudo crontab -e
3. sudo cat /etc/crontab
4. sudo ls /etc/cron.d

There should no active @reboot which looks like "cumulusmx.sh"

Please read my post before this post regarding access rights.
you should make a decision, using pi or sudo. using sudo should always work, but using another user will not start the script anymore without changing the onwners of the files first.

you can do the following. If you decide to work as user root, make sure, the /etc/init.d/cumulusmx user is "root"

sudo /home/pi/CumulusMX/cumulusmx.sh -q (This will stop CumulusMX)
sudo /etc/init.d/cumulusmx start (This will start CumulusMX by uising the init.d script which is starting my script)
Now please wait a minute and check if CumulusMX is running by using 2 different commands
sudo /etc/init.d/cumulusmx status
sudo /home/pi/CumulusMX/cumulusmx.sh -s

Both commands should indicate that CumulusMX is running.
If this is true, we are sure, that sudo /etc/init.d/cumulusmx start is able to start it.
mv /var/log/syslog /var/log/syslog_old (this will move a logfile to clean a little bit)
sudo reboot (reboot the Raspberry Pi)
Once it is up again: grep -i cumulusmx /var/log/syslog
you should see 3 entries

Code: Select all

Jan 18 14:39:15 raspberrypi systemd[1]: Starting LSB: Start cumulusmx.sh (CumulusMX) at boot time...
Jan 18 14:39:54 raspberrypi cumulusmx[351]: Starting CumulusMX...
Jan 18 14:39:54 raspberrypi systemd[1]: Started LSB: Start cumulusmx.sh (CumulusMX) at boot time.

Line 1 is the shutdown signal for the init.d script
Line 3 is a Information that the system started the Init.d Script at boot time
Line 2 (in the same second as line 3) indicate that the init.d script is called with option START
printf "%-50s" "Starting $NAME..."

Once this is done, please make a screenshot of the grep -i cumulusmx /var/log/syslog output.
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 » Tue Jan 19, 2016 4:18 pm

Thanks Jan, I'll give it another try tonight and report back. There might be a cronjob from my other attempt.

richard_newberry
Posts: 281
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 » Wed Mar 23, 2016 1:29 am

Hi,

I've tried out the init.d script and updated to V2.5.0

Error i'm getting is ifconfig command not found

error messages below: 

./cumulusmx.sh: line 148: ifconfig: command not found
./cumulusmx.sh: line 149: ifconfig: command not found
no port[s] to connect to
./cumulusmx.sh: line 573: ifconfig: command not found
./cumulusmx.sh: line 574: ifconfig: command not found

cumulus@debian:~/CumulusMX$ /etc/init.d/cumulusmx status
Checking CumulusMX... Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Process dead but pidfile exists

This is ran by user "cumulus"

Any suggestions would be appreciated.
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: 303
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 Mar 23, 2016 8:29 am

richard_newberry wrote:./cumulusmx.sh: line 148: ifconfig: command not found
./cumulusmx.sh: line 149: ifconfig: command not found no port[s] to connect to
./cumulusmx.sh: line 573: ifconfig: command not found
./cumulusmx.sh: line 574: ifconfig: command not found

Hi Richard

all the 4 lines in the cumulusmx.sh script are looking like this:
IPADDRESS=$(ifconfig $INTERFACE | grep 'inet ' | cut -d: -f2 | awk '{ print $1}')
NETMASK=$(ifconfig $INTERFACE | grep 'inet ' | cut -d: -f4 | awk '{ print $1}')

as you can see, the Linux command "ifconfig" is being sued to get the IP Address and netmask of your RaspberryPi
richard_newberry wrote:cumulus@debian:~/CumulusMX$ /etc/init.d/cumulusmx status
Checking CumulusMX... Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Process dead but pidfile exists

This is ran by user "cumulus"
Any suggestions would be appreciated.

[/quote]
yes, clearly insufficient rights for your user cumulus
Your user cumulus is not able to start andy basic system commands like ifconfig for example.
If you like, login as user cumulus and insert the command "ifconfig eth0"
you should get your network stats as a result but I bet you will get a "command not found"
Please check.

btw: the result: "Process dead but pidfile exists" is also on my system......when calling "sudo /etc/init.d/cumulusmx status"
I need to check this.....but this will not prevent cumulusmx.sh to start......

Recommendation:
Please login as user "cumulus" since oyu decided to run cumulusMX as user cumulus.
1) try to start the script as user cumulus (./cumulusmx.sh -s) I bet you will get an error messages like
You are running CumulusMX not as root (sudo) but as user: cumulus - but I found files in /CumulusMX which are having different owners
Below, there are some suggestions how to change the user rights of all files in the CumulusMX directory.
Example: sudo chown -R cumulus:cumulus /home/pi/CumulusMX
Once the owner of all files in your CumulusMX Directory are owned by the user you now want to use to run CumulusMX, it should not be a problem to start cumulusmx.sh
but always try to start the script with the useraccount you want to use in the future.
Once the Script and CumulusMX is running well (Please fix the rights problem with ifconfig) you can edit the /etc/init.d/cumulusmx script and in the head of this Init.d Script you can set the owner, who is starting CumulusMX when system starts:

CumulusMX_HOME=/CumulusMX
CumulusMX_USER=cumulus
NAME=CumulusMX
PIDFILE=/tmp/$NAME.pid


in your case, change CumulusMX_USER to cumulusmx
and reboot.

the only problem you have is, the mix of users who run CumulusMX and Fileowners.
Background: If you start cumulusmx.sh with sudo (sudo ./cumulusmx.sh) all files created in this moment are osnerd by user root. Also CumulusMX data files in the data folder will be owned by user root.
when oyu now decide to start cumulusmx.sh as user cumulus or pi, they will not have rights to write and read these file owned by root.
This is the reason why my script is stopping at this moment and checking if the ownership of the files currently in the folder are the same as user who is starting cumulusmx.sh
By the way, this problem will also happen if you not use my Script to start CumulusMX!
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: 281
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 » Wed Mar 23, 2016 9:06 am

Nah all files are owned by cumulus

Ifconfig eth0 came back not found.

I changed CumulusMX_HOME=/home/cumulus/CumulusMX

The problem is with ifconfig not letting user cumulus have access.

Can you edit your script so it can do this without restricted permissions?
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: 303
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 Mar 23, 2016 11:09 am

richard_newberry wrote:Nah all files are owned by cumulus

Ifconfig eth0 came back not found.
Can you edit your script so it can do this without restricted permissions?

Richard, I fear, that for this user not only the command "ifconfig" is not allowed, I am using also other Basic Linux commands which might also fail.
CURL, WGET, ZIP , find and many more.
I would suggest to change the permissions of this "cumulus" user account to get more rights.....
I think, your RaspberryPI is no Multi User System.....so it makes no sense to restrict the users to not have rights to call ifconfig (and probably other commands)
so please make the following test. Maybe it is a very basic thing. Maybe the path is ot in your environment path.
Can you please check if this is working:

/sbin/ifconfig eth0
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: 281
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 » Wed Mar 23, 2016 2:40 pm

Hi,

Im not using a raspberry pi im using debian on vmware esxi 6.0.

I dont use root because its very dangerous using root.

Do i need user cumulus just to have rights to the ifconfig command if so how? Would the errors go away?

Thanks for your time with your help your giving me on this matter.
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: 303
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 Mar 23, 2016 3:01 pm

Hi Richard
can you try:
/sbin/ifconfig eth0
or
locate ifconfig

and sudo locate ifconfig and sudo /sbin/ifconfig eth0 if the above commands fail

when logged in as cumulus ?

and to answer your question: you can use whatever user you like to rtun CumulusMX but the user of your choice needs to have enough rights to start some basic commands.

The user "cumulus" was created by yourself on your VMWARE and unfortuately had not enough rights.....or and this is thr reaosn why I asked you to run the above command - User cumulus can not find this command on your system.
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: 281
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 » Wed Mar 23, 2016 4:12 pm

I will let you know in a bit what the commands say.

I may need to add user cumulus to access ifconfig.
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!!

richard_newberry
Posts: 281
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 » Wed Mar 23, 2016 10:13 pm

Hi Mate,

The command /sbin/ifconfig eth0 works as user cumulus

but ifconfig doesn't.

So how do I get this working without those errors? script only uses ifconfig do I put /sbin before ifconfig?
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: 303
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 Mar 23, 2016 10:45 pm

Hi Richard
Give me some Time. I will find a way for you without modifying the program.
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

freddie
Posts: 273
Joined: Wed Jun 08, 2011 11:19 am
Weather Station: Davis Vantage Pro 2
Operating System: GNU/Linux (Ubuntu 18.04)
Location: Ystrad, Rhondda, Wales
Contact:

Re: RaspberryPi: CumulusMX init.d System Startup Script

Postby freddie » Thu Mar 24, 2016 9:40 am

richard_newberry wrote:So how do I get this working without those errors? script only uses ifconfig do I put /sbin before ifconfig?
Add /sbin to the PATH environment variable for your "cumulus" user.
Freddie
Image

richard_newberry
Posts: 281
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 » Thu Mar 24, 2016 10:15 am

Which path. There's so many paths lol.
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: 303
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 » Thu Mar 24, 2016 11:19 am

Hello Richard

2 Options:

Option 1: I will do this for you in my Script, adding an "export" line
Option 2: And I would prefer this--> Please read carefully here ---> http://blog.tordeu.com/?p=374

sudo nano /etc/profile
This file is probably looking like this

if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi

The red Line is for user root and the green for all other suers.
So maybe in root's line the sbin path is present in the users line not.
Add /sbin into this line and save
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin"

This should do it.
MAybe you need to logout and login again before it works
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


Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 3 guests