tools/rc.thermferm

changeset 675
825210ba2707
parent 640
0f6daacdd597
equal deleted inserted replaced
674:6cabc02f4c8d 675:825210ba2707
8 if [ -r /etc/default/thermferm ]; then 8 if [ -r /etc/default/thermferm ]; then
9 . /etc/default/thermferm 9 . /etc/default/thermferm
10 fi 10 fi
11 11
12 PIDFILE=/run/thermferm.pid 12 PIDFILE=/run/thermferm.pid
13 STOPTIME=45
13 14
14 case "$1" in 15 case "$1" in
15 start) 16 start)
16 echo -n "Starting Fermentation Controller: " 17 echo -n "Starting Fermentation Controller: "
17 if [ -f ${PIDFILE} ]; then 18 if [ -f ${PIDFILE} ]; then
24 25
25 stop) 26 stop)
26 echo -n "Stopping Fermentation Controller: " 27 echo -n "Stopping Fermentation Controller: "
27 if [ -f ${PIDFILE} ]; then 28 if [ -f ${PIDFILE} ]; then
28 kill $(cat ${PIDFILE}) 29 kill $(cat ${PIDFILE})
30 tim=0
31 while [ true ]; do
32 [ ! -f "${PIDFILE}" ] && break;
33 [ $tim -gt $STOPTIME ] && break;
34 echo -n "."
35 sleep 1
36 tim=$(($tim+1))
37 done
29 echo "done." 38 echo "done."
30 else 39 else
31 echo "wasn't running." 40 echo "wasn't running."
32 fi 41 fi
33 ;; 42 ;;

mercurial