17-08-2016, 03:15
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:
Surely there are better ways to do this... I let that for the Linux experts.
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.
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 0Surely 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.

