mirror of
https://github.com/bol-van/zapret.git
synced 2025-04-17 04:22:59 +03:00
sysv: remove daemonize. use pgrep to detect already running state
This commit is contained in:
parent
9bc42db2d5
commit
bce09d0772
@ -312,7 +312,7 @@ Centos с 7 версии и более-менее новые федоры пос
|
||||
В качестве пакетного менеджера используется yum.
|
||||
|
||||
Установить пакеты :
|
||||
yum install -y curl ipset dnsutils git daemonize
|
||||
yum install -y curl ipset dnsutils git
|
||||
|
||||
Далее все аналогично debian.
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user