File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
TIMEOUT=10
3
3
SIGNAL=HUP
4
+ PIDFILE=.send.pid
4
5
if [ $# -eq 0 ]; then
5
6
echo -e " Usage:\t$0 <cmd>"
6
7
echo -e " \tRuns <cmd> and wait ${TIMEOUT} seconds or until SIG${SIGNAL} is received."
7
8
echo -e " \tReturns: 0 if SIG${SIGNAL} is received, 1 otherwise."
9
+ echo -e " Or:\t$0 -STOP"
10
+ echo -e " \tsends SIG${SIGNAL} to running send.sh"
8
11
exit 0
9
12
fi
13
+
14
+ if [ $1 == " -STOP" ]; then
15
+ if [ -s ${PIDFILE} ]; then
16
+ kill -s ${SIGNAL} $( < ${PIDFILE} )
17
+ fi
18
+ exit 0
19
+ fi
20
+
10
21
trap ' [[ ${PID} ]] && kill ${PID}' ${SIGNAL}
22
+ trap ' rm -f ${PIDFILE}' EXIT
23
+ echo $$ > ${PIDFILE}
11
24
" $@ "
12
25
sleep ${TIMEOUT} & PID=$!
13
26
wait ${PID} && exit 1
27
+
14
28
exit 0
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ function CreateDataDir {
23
23
echo " rpcuser=rt" >> $CONF
24
24
echo " rpcpassword=rt" >> $CONF
25
25
echo " rpcwait=1" >> $CONF
26
- echo " walletnotify=killall -HUP ` basename ${SENDANDWAIT} ` " >> $CONF
26
+ echo " walletnotify=${SENDANDWAIT} -STOP " >> $CONF
27
27
shift
28
28
while (( "$# " )) ; do
29
29
echo $1 >> $CONF
You can’t perform that action at this time.
0 commit comments