diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2012-08-03 11:14:22 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2013-07-15 14:01:26 +0200 |
commit | 355815c2d706425da85d4a8312025baeecbcfaae (patch) | |
tree | 93779ae219c24d9c08a7cfe123326e2c74e387b3 /rc.d | |
parent | 113eddd9c3e7e0cc2b68627864e7d85a9542265d (diff) | |
download | initscripts-355815c2d706425da85d4a8312025baeecbcfaae.tar initscripts-355815c2d706425da85d4a8312025baeecbcfaae.tar.gz initscripts-355815c2d706425da85d4a8312025baeecbcfaae.tar.bz2 initscripts-355815c2d706425da85d4a8312025baeecbcfaae.tar.xz initscripts-355815c2d706425da85d4a8312025baeecbcfaae.zip |
Killproc -d should parse same values as sleep
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 10a108a9..d5a654dd 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -271,7 +271,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]" @@ -282,7 +282,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 |