Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Raspberry Pi and Cumulus MX
#66

For those using CumulusMX init.d System Startup Script
as described here:

http://sandaysoft.com/forum/viewtopic.php?f=27&t=14753

may be useful adding a sleep instruction to the script. In case of a power failure, this will try to ensure that CumulusMX only starts after the RX unit is ready for connection (give time for it receive data from external sensors).

Look to sleep 180 instruction, at line 14:

Code:
#!/bin/bash
# /etc/init.d/cumulusmx
### BEGIN INIT INFO
# Provides:          cumulusmx.sh
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start cumulusmx.sh (CumulusMX) at boot time
# Description:       Enable service provided by daemon.
# chkconfig:         2345 95 05
# Version:           1.2 - 08.06.2016
### END INIT INFO
sleep 180
CumulusMX_HOME=/mnt/SSD/Weather/CumulusMX
CumulusMX_USER=root

NAME=CumulusMX
PIDFILE=/tmp/$NAME.pid

# Wait until external drive with CumulusMX is mounted
x=0
while [ "$x" -lt 300 -a ! -e $CumulusMX_HOME/Cumulus.ini ]; do
   x=$((x+1))
   sleep .1
done
if [ -e $CumulusMX_HOME/Cumulus.ini ]
then
   echo "$(date +"%b %d %H:%M:%S") CumulusMX init.d-Script: CumulusMX is being started at system boot within "$x" seconds"
else
   echo "$(date +"%b %d %H:%M:%S") CumulusMX init.d-Script: CumulusMX could not be started - unable to mount "$CumulusMX_HOME" within 30 seconds"
   exit 1
fi
# End - Wait until external drive with CumulusMX is mounted

case $1 in
  start)
       printf "%-50s" "Starting $NAME..."
       WHOAMI=$(whoami)
       if [ "$CumulusMX_USER" != "$WHOAMI" ]; then
       /bin/su $CumulusMX_USER $CumulusMX_HOME/cumulusmx.sh >/dev/null 2>&1
       else
       $CumulusMX_HOME/cumulusmx.sh >/dev/null 2>&1
       fi
       ;;
  stop)
       echo -e "Stopping $NAME\n"
       $CumulusMX_HOME/cumulusmx.sh -q >/dev/null 2>&1
       ;;
  restart)
        printf "%-50s" "Restarting $NAME"
       $CumulusMX_HOME/cumulusmx.sh -r
       ;;
  force-reload)
       printf "%-50s" "Reloading $NAME"
       $CumulusMX_HOME/cumulusmx.sh -q
       $CumulusMX_HOME/cumulusmx.sh
       ;;
   status)
        printf "%-50s" "Checking $NAME..."
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%s\n" "Process dead but pidfile exists"
            else
                echo "Running"
            fi
        else
            printf "%s\n" "Service not running"
        fi
       ;;
   *)
    echo "Usage: /etc/init.d/cumulusmx {start|stop|force-reload|status}"
    exit 1
    ;;
esac
exit 0

Surely there are better ways to do this... I let that for the Linux experts.


(16-08-2016, 11:13)qldbureau Wrote:  ...
I want to show again the stability of WeatherDuino. This was my up time status just before I took the system offline for the updates.

Thanks qldbureau.
I'm also very happy with the v2.0 software. I really recommend to everybody to upgrade to v2.0 as soon as possible.

Reply


Messages In This Thread
Raspberry Pi and Cumulus MX - by qldbureau - 03-10-2015, 10:46
RE: Raspberry Pi and Cumulus MX - by JT118 - 03-10-2015, 18:10
RE: Raspberry Pi and Cumulus MX - by qldbureau - 03-10-2015, 23:00
RE: Raspberry Pi and Cumulus MX - by dormani - 04-10-2015, 00:57
RE: Raspberry Pi and Cumulus MX - by qldbureau - 07-10-2015, 05:00
RE: Raspberry Pi and Cumulus MX - by werk_ag - 13-10-2015, 01:47
RE: Raspberry Pi and Cumulus MX - by qldbureau - 12-10-2015, 11:51
RE: Raspberry Pi and Cumulus MX - by qldbureau - 17-10-2015, 23:31
RE: Raspberry Pi and Cumulus MX - by werk_ag - 18-10-2015, 01:23
RE: Raspberry Pi and Cumulus MX - by qldbureau - 18-10-2015, 10:30
RE: Raspberry Pi and Cumulus MX - by werk_ag - 29-10-2015, 02:34
RE: Raspberry Pi and Cumulus MX - by qldbureau - 29-10-2015, 11:55
RE: Raspberry Pi and Cumulus MX - by werk_ag - 30-10-2015, 05:24
RE: Raspberry Pi and Cumulus MX - by Wizza - 24-04-2016, 12:07
RE: Raspberry Pi and Cumulus MX - by Shred - 24-04-2016, 22:34
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 24-04-2016, 12:19
RE: Raspberry Pi and Cumulus MX - by laulau - 24-04-2016, 17:44
RE: Raspberry Pi and Cumulus MX - by werk_ag - 24-04-2016, 21:11
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 25-04-2016, 01:14
RE: Raspberry Pi and Cumulus MX - by Wizza - 25-04-2016, 01:41
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 25-04-2016, 03:04
RE: Raspberry Pi and Cumulus MX - by werk_ag - 25-04-2016, 04:32
RE: Raspberry Pi and Cumulus MX - by Shred - 25-04-2016, 04:40
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 25-04-2016, 08:03
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 25-04-2016, 05:25
RE: Raspberry Pi and Cumulus MX - by Shred - 27-04-2016, 02:22
RE: Raspberry Pi and Cumulus MX - by laulau - 25-04-2016, 11:32
RE: Raspberry Pi and Cumulus MX - by werk_ag - 26-04-2016, 05:07
RE: Raspberry Pi and Cumulus MX - by hornychz - 26-04-2016, 11:51
RE: Raspberry Pi and Cumulus MX - by werk_ag - 27-04-2016, 03:32
RE: Raspberry Pi and Cumulus MX - by Wizza - 26-04-2016, 21:31
RE: Raspberry Pi and Cumulus MX - by hornychz - 27-04-2016, 11:18
RE: Raspberry Pi and Cumulus MX - by Wizza - 29-04-2016, 21:27
RE: Raspberry Pi and Cumulus MX - by hornychz - 29-04-2016, 23:03
RE: Raspberry Pi and Cumulus MX - by Wizza - 30-04-2016, 09:32
RE: Raspberry Pi and Cumulus MX - by hornychz - 30-04-2016, 12:52
RE: Raspberry Pi and Cumulus MX - by Wizza - 30-04-2016, 20:12
RE: Raspberry Pi and Cumulus MX - by Shred - 30-04-2016, 22:54
RE: Raspberry Pi and Cumulus MX - by hornychz - 30-04-2016, 23:26
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 30-04-2016, 23:52
RE: Raspberry Pi and Cumulus MX - by Wizza - 01-05-2016, 02:35
RE: Raspberry Pi and Cumulus MX - by Wizza - 01-05-2016, 06:05
RE: Raspberry Pi and Cumulus MX - by hornychz - 01-05-2016, 10:56
RE: Raspberry Pi and Cumulus MX - by Dariusz - 15-10-2025, 16:16
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 01-05-2016, 10:54
RE: Raspberry Pi and Cumulus MX - by werk_ag - 03-05-2016, 01:48
RE: Raspberry Pi and Cumulus MX - by hornychz - 03-05-2016, 08:34
RE: Raspberry Pi and Cumulus MX - by Wizza - 03-05-2016, 22:16
RE: Raspberry Pi and Cumulus MX - by zitoune - 25-05-2016, 08:03
RE: Raspberry Pi and Cumulus MX - by hornychz - 25-05-2016, 17:08
RE: Raspberry Pi and Cumulus MX - by Wizza - 25-05-2016, 10:02
RE: Raspberry Pi and Cumulus MX - by zitoune - 27-05-2016, 15:36
RE: Raspberry Pi and Cumulus MX - by hornychz - 27-05-2016, 15:58
RE: Raspberry Pi and Cumulus MX - by Wizza - 27-05-2016, 21:53
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 07-06-2016, 22:46
RE: Raspberry Pi and Cumulus MX - by Wizza - 07-06-2016, 22:58
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 08-06-2016, 05:42
RE: Raspberry Pi and Cumulus MX - by hornychz - 07-06-2016, 23:47
RE: Raspberry Pi and Cumulus MX - by Wizza - 08-06-2016, 22:13
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 09-06-2016, 23:36
RE: Raspberry Pi and Cumulus MX - by werk_ag - 10-06-2016, 04:21
RE: Raspberry Pi and Cumulus MX - by zitoune - 10-06-2016, 14:35
RE: Raspberry Pi and Cumulus MX - by spudstrawb - 24-06-2016, 23:59
RE: Raspberry Pi and Cumulus MX - by werk_ag - 25-06-2016, 00:05
RE: Raspberry Pi and Cumulus MX - by Wizza - 25-06-2016, 03:34
RE: Raspberry Pi and Cumulus MX - by qldbureau - 16-08-2016, 11:13
RE: Raspberry Pi and Cumulus MX - by werk_ag - 17-08-2016, 03:15
RE: Raspberry Pi and Cumulus MX - by markkkk42 - 31-12-2016, 12:40



Users browsing this thread: 1 Guest(s)