init-script-template
init-script-template copied to clipboard
stop for loop
I think in Bourne shell the loop for i in {1..10}
is not working. At least for me it only goes through once and causes the stop
to not wait long enough. Other scripts I looked at tend to use other type of loops.
Same problem here. It's got #!/bin/sh at the top of the script but init v or whatever is running it using bash. Any idea what type of loop we should use instead?
I replaced line 47 to line 57 with:
kill `get_pid`
i=0
while is_running; do
if [ $i = '60' ]; then
break;
else
echo -n "."
i=$(($i+1))
sleep 1
fi
done
echo
Also I raised the max waiting time to 60 seconds
hehe, I did something similar
(and then I call kill -9 if it still doesn't die)
It is Bourne shell, so I used for i in 1 2 3 4 5 6 7 8 9
instead of for i in {1..10}
http://steve-parker.org/sh/loops.shtml