diff options
Diffstat (limited to 'rc.d')
-rw-r--r-- | rc.d/init.d/functions | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 19f389dd..8c4d2573 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -233,7 +233,7 @@ daemon() { killproc() { local RC killlevel= base pid pid_file= delay try - RC=0; delay=3 + RC=0; delay=3; try=0 # Test syntax. if [ "$#" -eq 0 ]; then echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" @@ -244,7 +244,11 @@ killproc() { shift 2 fi if [ "$1" = "-d" ]; then - delay=$2 + delay=$(echo $2 | awk -v RS=' ' -v IGNORECASE=1 '{if($1!~/^[0-9.]+[smhd]?$/) exit 1;d=$1~/s$|^[0-9.]*$/?1:$1~/m$/?60:$1~/h$/?60*60:$1~/d$/?24*60*60:-1;if(d==-1) exit 1;delay+=d*$1} END {printf("%d",delay+0.5)}') + if [ "$?" -eq 1 ]; then + echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" + return 1 + fi shift 2 fi |