gsmd: Work on stopping the respawn script and children
This is using some brute force. Make the shell script write a PID file and on stop kill the respawn script and then all process names that are spawned. For the stop we need to know that this is a bash script.
This commit is contained in:
parent
35ff59937b
commit
7aa59c430e
|
@ -7,11 +7,13 @@
|
|||
# processname: cell_log
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
PIDFILE=/var/run/cell_log.pid
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting cell-log: "
|
||||
start-stop-daemon -S -b -x /etc/gsmd-respawn.sh /usr/bin/cell_log
|
||||
start-stop-daemon -S -b -p $PIDFILE \
|
||||
-x /etc/gsmd-respawn.sh /usr/bin/cell_log
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
echo "cell-log"
|
||||
|
@ -21,7 +23,7 @@ case "$1" in
|
|||
;;
|
||||
stop)
|
||||
echo -n "Stopping GSM daemon: "
|
||||
start-stop-daemon -K -x /usr/bin/cell_log
|
||||
start-stop-daemon -K -x bash -p $PIDFILE
|
||||
echo "cell-log."
|
||||
;;
|
||||
restart|force-reload)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# processname: gsmd
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
PIDFILE=/var/run/gsmd.pid
|
||||
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
[ -f /etc/default/gsmd ] && . /etc/default/gsmd
|
||||
|
@ -19,7 +20,8 @@ case "$1" in
|
|||
[ -n "$GSM_RES" ] && ( echo "0" >$GSM_RES; sleep 2 )
|
||||
|
||||
echo -n "Starting GSM daemon: "
|
||||
start-stop-daemon -S -b -x /etc/gsmd-respawn.sh /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS -l syslog
|
||||
start-stop-daemon -S -p $PIDFILE -b \
|
||||
-x /etc/gsmd-respawn.sh /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS -l syslog
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
echo "gsmd."
|
||||
|
@ -31,7 +33,7 @@ case "$1" in
|
|||
[ -n "$GSM_POW" ] && echo "0" >$GSM_POW
|
||||
|
||||
echo -n "Stopping GSM daemon: "
|
||||
start-stop-daemon -K -x /usr/sbin/gsmd
|
||||
start-stop-daemon -K -x bash -p $PIDFILE
|
||||
echo "gsmd."
|
||||
;;
|
||||
restart|force-reload)
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
NAME=`basename $1`
|
||||
PIDFILE="/var/run/$NAME.pid"
|
||||
PID=$$
|
||||
echo "$PID" > $PIDFILE
|
||||
|
||||
trap "{ rm -f $PIDFILE ; killall -9 $NAME; }" EXIT
|
||||
|
||||
while true;
|
||||
do
|
||||
echo "Restarting not dealing well with spaces.."
|
||||
|
|
Loading…
Reference in New Issue