diff options
-rwxr-xr-x | usr/local/sbin/freshclamd | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr/local/sbin/freshclamd b/usr/local/sbin/freshclamd index a3bc2b3..1dd474d 100755 --- a/usr/local/sbin/freshclamd +++ b/usr/local/sbin/freshclamd @@ -7,16 +7,11 @@ fresh_start() { fresh_stop() { if [ ! -e "$FCPIDF" ];then - pidof "$(which freshclam)" >/dev/null - [ "$?" -eq 0 ]&&exit 1 + pidof "$(which freshclam)" >/dev/null&&exit 1 else FCPID="$(cat "$FCPIDF")" [ -z "$FCPID" ]&&exit 2 - ps -p "$FCPID" >/dev/null 2>&1 - if [ "$?" -ne 0 ];then - rm -f "$FCPIDF" >/dev/null 2>&1 - [ "$?" -ne 0 ]&&exit 3 - else + if ps -p "$FCPID" >/dev/null 2>&1; then kill "$FCPID" >/dev/null 2>&1 sleep 1 ps -p "$FCPID" >/dev/null 2>&1||exit 0 @@ -24,6 +19,8 @@ fresh_stop() { kill -9 "$FCPID" >/dev/null 2>&1 sleep 2 ps -p "$FCPID" >/dev/null 2>&1&&exit 4||exit 0 + else + rm -f "$FCPIDF" >/dev/null 2>&1||exit 3 fi fi } |