cache: support persist cache when restart smartdns

This commit is contained in:
Nick Peng
2020-09-05 12:55:30 +08:00
parent 2b81fffb7e
commit 0b45da29c7
13 changed files with 447 additions and 80 deletions

View File

@@ -332,9 +332,28 @@ case "$1" in
return 0
fi
if [ ! -d "/proc/$pid" ]; then
return 0;
kill -15 "$pid" 2>/dev/null
SLEEP=`which usleep`
SLEEPTIME=200000
if [ -z "$SLEEP" ]; then
SLEEP="sleep"
SLEEPTIME=0.2
fi
N=30
while [ $N -gt 0 ]
do
pid="$(cat "$SMARTDNS_PID" | head -n 1 2>/dev/null)"
if [ -z "$pid" ]; then
return 0
fi
if [ ! -d "/proc/$pid" ]; then
return 0;
fi
$SLEEP $SLEEPTIME 2>/dev/null
N=$((N-1))
done
kill -9 "$pid" 2>/dev/null
;;