I wrote a little script to Start Stop Restart Cumulus on a Raspberry Pi or Linux System
It is often very useful to run Cumulus in a so called headless mode on console window without a attached keyboard etc.
Since Cumulus can not be "deamonized" yet, one option is to run Cumulus in a so called: "Screen Session". This allows you to connect to the Linux Box via SSH, starting CumulusMX and close the SSH Session again.
Once you logged out and logged in again, you are able to "find" your Cumulus again and Start/Restart or Quit it by using this small bash script
This script can be called without so called "root rights" by using the command sudo and since Version 2.4.x also as normal user (usually user pi)
Attention: Whenn the script is being started with root rights (sudo) some file in the CumulusMX folder might belong to the suer account root. In this case, it might happen, that other users are not allowed to write into the Files and CumulusMX will not start. So you should think about how you want to use the script. With sudo, or as normal user without sudo.
The Script will find out, if it is previously being started as root (sudo) and in case, it will prompt with an error message to hange the owner of the files first.
It is always possible to start the scrpt as user pi and call Script with options as user root (sudo).
Start this script with sudo ./cumulusmx.sh or sudo /home/pi//CumulusMX/cumulusmx.sh
Alternatively ./cumulusmx.sh or /home/pi//CumulusMX/cumulusmx.sh
Based on the location where you installed CumuluxMX
If CumulusMX (as Screen) is already running, the Script ask to Stop CumulusMX (y/n)
If CumulusMX is not running it is starting CumulusMX as Screen.
If you call the script with
-r, it will immidiately restart CumulusMX (sudo ./cumulusmx.sh -r)
-q, it will immidiately quit Cumulus, sending a CTR+C (sudo ./cumulusmx.sh -c)
-s, it will display the status of CumulusMX - Also when not running (sudo ./cumulusmx.sh -s)
-h, it will display a Help Screen with the list of available commands (sudo ./cumulusmx.sh -h)
-p 1-65535, it will start on this TCP Port instead of default TCP Port 8998. (the Default Port can be modified within the the top of the script)
-d, it will switch back to the "unscreened" Session. You can switch back to the Screen session by typing "CTRL-A" and "D"
-b -t > will create a tar.gz Backup | -b -z > will create a zip Backup | -b -dd > will create a dd Backup of the SD Card | -b -c will create a Cloud Backup. Define the Backup folder in cumulusmxsh.conf
-v Print current Version of this Script
-u will Update the CumulusMX installation form an official ZIP File
-l will show a small menu where Logfiles and other import CumulusMX relevant files can be listed
-m will create a zip File which contain the latest MXdiag-log file in folder MXdiags. Can be used to easily upload to Cumulux Forum
-c Application , System and Network Check - Will guide you through a System check: Network Settings/FTP Settings/CumulusMX Basic config check
-n Cumulus Now will display the current CumulusMX weather values in the SSH Session - in a 5 Minutes loop
-system [-s,-r] will display a menu to stop CumulusMX and reboot/shutdown system. Optional -system [-r, -s] will immidiately reboot/shutdown without menu. Good for use this in cron.
If you call without Paramaters it will find out, if Cumulus is running or not and will ask to start or in case it's running, ask to stop.
1. Install screen and Mono(*) on your Raspberry Pi
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install screen
sudo apt-get install mono-complete
* Regarding correct version of mono for your RapsberryPi, please refer to these Forum posts
http://sandaysoft.com/forum/viewtopic.php?f=27&t=13587 http://sandaysoft.com/forum/viewtopic.php?f=27&t=14222 and
2. Download and copy the script
At the end of this post, you can find this script as a downloadable zip file
Copy the Script (cumulusmx.sh) and the config file (cumulusmxsh.conf) into the same folder as CumulusMX.exe
Copy ZIP File into this folder
3. Unzip Script and make the script executable
sudo unzip /path_to_script/cumulusmx_2.x.x.zip
sudo chmod +x /path_to_script/cumulusmx.sh
Make some basic settings in the cumulusmxsh.conf file --> sudo nano cumulusmxsh.conf
Run the Script by using : sudo /path_of_script/cumulusmx.sh or sudo ./cumulusmx.sh
If you encountering problems, please start CumulusMX first without using this Script and check for possible errors (http://sandaysoft.com/forum/viewtopic.php?f=27&t=12908)
When you call this script the first time, you maybe see some errors like
find: `/tmp/CumulusMX.pid': No such file or directory
find: `/home/pi/CumulusMX//MXdiags/*.txt': No such file or directory
...which can be ignored.
4. Insert this Script into cron to be started at boot time
I used this method instead of /etc/init.d/ but maybe later I'll try this
sudo crontab -e
Scroll down to the bottom of the list and insert this line
Code: Select all
#If the init.d Script is not working for your Raspberry Pi, please try to start CumulusMX with the -w Parameter (Watchdog) */10 * * * * /home/pi/CumulusMX/cumulusmx.sh -w #if you like a daily restart at 5 am 0 5 * * * sudo /home/pi/CumulusMX/cumulusmx.sh -r >> /dev/null 2>&1 # In case you want to make a frequent backup of the CumulusMX folder every day around midnight 59 23 * * * sudo /home/pi/CumulusMX/cumulusmx.sh -b -z >> /dev/null 2>&1 # In case you want to make a backup of the Raspberrypi once per week on Sunday Morning 00 06 * * 7 sudo /home/pi/CumulusMX/cumulusmx.sh -b -d >> /dev/null 2>&1 # In case you want to reboot your RaspberryPi each sunday morning at 6:15 am 15 6 * * 7 /usr/bin/sudo /home/pi/cumulusmx.sh -system -r >> /dev/null 2>&1
If you are on Debian 8 (Jessie) or Debian 7 (Wheezy) please try to start this Script by using /etc/init.d instead of cron - I announced in this thread
Most current Version Previous Version [/i]
CumulusNow CumulusNow is a script visualizing weatherstation values based on CumulusMX in a Putty Session-
PLease see also CumulusNow: Forum Post
Version 1.1: Search the Server for install path of CumulusMX.exe, that the script can be placed anywhere on the System.
Version 1.2: Preventing Script to Search Cumulus Install Path on Network shares
Version 1.3: System Uptime included in output - Better formatting of Cumulus status output
Version 1.4: Will check if Script is being called as root - otherwise will quit the script
Version 1.5: [11.05.2015] Some cosmetical improvments - adding CumulusMX uptime in the status messages - writing pid file in /run/
Version 1.6: [14.05.2015] Fixed some obsolete CRLF in the script which caused errors in some cases
Version 1.7: [16.05.2015] Added possibillity to call the script with -r (restart) for immidiately restart of CumulusMx --> "sudo ./cumulusmx.sh -r"
Version 1.8: [20.05.2015] Improved error Handling - Added possibillity to run with more parameters -s (Status), -q (Quit) , -h Help --> sudo ./cumulusmx [OPTION] [-h,-r,-q,-s]
Version 1.9: [23.05.2015] TCP Port can be set in the Script - Added possibillity to call Script with a port Number: sudo ./cumulusmx -p 12345 to start Cumulus on Port 12345 - Detecting IP Address of ETH0 / Displaying the complete URL with Port
Version 2.0: [25.05.2015] Added new Parameter -d (will resume detached Screen session) - Can be screened again with CTR-A and D - Installation folder can be set within the head of the script by using editor (nano) - if folder name is other then CumulusMX - Fixed: Errorhandling in detecting installation path, if more than 1 CumulusMX folder is present (Backup on Network Strage for example)
Version 2.0.2: [29.05.2015] Added new Parameter -b (Backup) in combination with -t (tar.gz) -z (zip) and -d for DD Backup of the SD Card.
Version 2.0.6: [02.06.2015] Added new Parameter -u (Update) Script will ask you for the path of the CumulusMX ZIP File and will update the installation (It is possible to exclude a directory in the zip to be extracted for example: "web" folder , to not overwrite your own web template files)
Version 2.0.7: [04.06.2015] Remove obsolete characters from the script which might causes errors on many Linux systems: (sudo: unable to execute ./cumulusmx.sh: No such file or directory)
Version 2.1.0: [11.06.2015] Added new Parameter -l (list logfiles - Menu). This will give you the option to list some of the important logfiles or folder of CumulusMX installation - Added coloured run-status on Status Page - Detect CumulusMX Version and display with -s . Improved the error handling
Version 2.1.1: [14.06.2015] Get Cumulus Version did not work because "xargs" missing in command - Error File not found -> was fixed in this version (Sorry for inconvenience)
Version 2.1.3: [15.06.2015] Added new Parameter -m (create zip of latest MXdiags file into MXdiags folder) - Error: MXVersion finally fixed now - Script will check remaining diskspace. If threshold of 90% is reached, it will Alert in RED when using this Script (if 80% is reacxhed, a yellow warning will be displayed.
Version 2.1.6: [19.06.2015] Added new Parameter -c (Application , System and Network Check - Will guide you through a System check: Network Settings/FTP Settings/CumulusMX Basic config check) - Abbillity to check the installed script version aginst the most current version (Will be displayed with -s
Version 2.1.7: [21.06.2015] Bugfix. removed hardcoded path from script.
Version 2.2.0: [18.07.2015] Added "Cumulus Now" - will display current weather conditions within the SSH session in a 5 Minutes loop
Version 2.2.1: [29.07.2015] Option -n will show currentl Weatherstation values and will call an external script which can be downloaded here in this forum or directly within the script when option -n is called. (Will ask to download)
Version 2.2.4: [01.09.2015] Removed some obsolete sudo's - fixed a bug when calling option -l -> "Show mmmyylog.txt log live-view" Added option -system [-r,-s]
Version 2.2.5: [01.10.2015] Fixed month display in option -l - added Version Check Cumulusnow.sh - Check updated for Mono V4 - Check if /dev/ttyUSB0 is present and configured
Version 2.2.7: [13.10.2015] Fixed: System menu (-system) is now able to reboot/restart, not a fake anymore - Check if RaspberryPi using Wireless Interface wlan0. If this is the case, the start of CumulusMX will be deferred because of WPA Handshake is slower than System start and IP might be not assigned. This prevent CumulusMX not to not start without a bound IP Address to an interface when used in cron while (re)boot - Fixed Status output/pages when using interfaces other than eth0.
Version 2.3.0: [26.10.2015] Fixed: System Uptime will now be displayed properly - Abillity to display all used Variables when using option -l (Menu) - Added fancy progress bar when cumulusmx is being started to get more time before option -s is displaying an error - New look of Status information screen - checking for available Version of CumulusMX - when RaspberryPi using external USB Drive or DHCP, Script will wait until USB Drive is up or IP Address is assigned
Version 2.4.0: [22.12.2015] Script can now be started as non root user (sudo not requiered anymore) - list of all fixes and news on Page 13
Version 2.5.0: [19.02.2016] + Added Logfile option. - list of all fixes and news on Page 17
Version 18.104.22.168: [10.04.2016] + Added Cloud Backup function (WebDav)
Version 22.214.171.124: [02.05.2016] + Added Cloud Backup check in the system check section (cumulusmx.sh -c)
Version 126.96.36.199: [02.09.2016] - Fixed Version check for CumulusMX because changes on the Cumulus Webpages were made.
Version 188.8.131.52: [27.09.2016] - Added Parameter -w (watchdog). In case CumulusMX can not be started with the init.d script, create a cron entry which is starting CumulusMX every 10 minutes. In case it is already running, nothing happens. If not running, it will be startet
Version 184.108.40.206: [21.01.2017] - fixed CumulusMX version check since Steve modified the Forum website
Version 220.127.116.11: [21.02.2017] - fixed a problem with the init.d script when CumulusMX is installed on a USB Drive. CumulusMX could not be started at system boot. This version fixed this problem. Please read Forum post for more information.
Version 18.104.22.168: [11.09.2017] - fixed a problem with the status page when using Debian Stretch - Sorry for being so late with the fix
Please read Forum post for more information.
INIT.D Script: [08.01.2016] CumulusMX Init.d Script added as a replacement for a cron entry to start at boot