diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2012-08-03 11:14:22 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2012-08-07 14:42:15 +0200 |
commit | eb8425399e577b6d0a7521dd09dfafab975932d2 (patch) | |
tree | 969cfe8347c824ac7950aac6b3f5b0a9f345ed72 /rc.d/init.d | |
parent | 6b51ac2eb4581c5ec50d6771fd5ebf335bd634f4 (diff) | |
download | initscripts-eb8425399e577b6d0a7521dd09dfafab975932d2.tar initscripts-eb8425399e577b6d0a7521dd09dfafab975932d2.tar.gz initscripts-eb8425399e577b6d0a7521dd09dfafab975932d2.tar.bz2 initscripts-eb8425399e577b6d0a7521dd09dfafab975932d2.tar.xz initscripts-eb8425399e577b6d0a7521dd09dfafab975932d2.zip |
Killproc -d should parse same values as sleep
Diffstat (limited to 'rc.d/init.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 |