diff --git a/docs/readme.txt b/docs/readme.txt index b46d443..1f0694b 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -312,7 +312,7 @@ Centos с 7 версии и более-менее новые федоры пос В качестве пакетного менеджера используется yum. Установить пакеты : - yum install -y curl ipset dnsutils git daemonize + yum install -y curl ipset dnsutils git Далее все аналогично debian. diff --git a/init.d/sysv/zapret b/init.d/sysv/zapret index 1f40474..c1fe5c8 100755 --- a/init.d/sysv/zapret +++ b/init.d/sysv/zapret @@ -108,16 +108,18 @@ run_daemon() echo "Starting daemon $1: $2 $3" if exists start-stop-daemon ; then start-stop-daemon --start --pidfile "$PIDFILE" --background --make-pidfile --exec "$2" -- $3 || true - elif exists daemonize ; then - daemonize -p "$PIDFILE" "$2" $3 else - nohup "$2" $3 >/dev/null 2>/dev/null & - PID=$(jobs -p %$JOBCT) - if [ -n "$PID" ]; then - echo $PID >$PIDFILE - JOBCT=$(($JOBCT+1)) + if [ -f "$PIDFILE" ] && pgrep -F "$PIDFILE" $(basename "$2") >/dev/null; then + echo already running else - echo could not start daemon $1 : $2 $3 + nohup "$2" $3 >/dev/null 2>/dev/null & + PID=$(jobs -p %$JOBCT) + if [ -n "$PID" ]; then + echo $PID >$PIDFILE + JOBCT=$(($JOBCT+1)) + else + echo could not start daemon $1 : $2 $3 + fi fi fi }