First Commit
[librecmc/package-feed.git] / net / privoxy / files / privoxy.hotplug
1 #!/bin/sh
2
3 # only (re-)start on ifup
4 [ "$ACTION" = "ifup" ] || exit 0
5 # only start if boot_delay is done
6 [ -f /tmp/privoxy.hotplug ] || exit 0
7
8 PIDFILE=/var/run/privoxy.pid
9
10 _PID=$(cat $PIDFILE 2>/dev/null)
11 kill -1 $_PID 2>/dev/null
12 if [ $? -eq 0 ]; then
13         # only restart if already running
14         logger -p daemon.info -t "privoxy[$_PID]" \
15                 "Restart request due to '$ACTION' of interface '$INTERFACE'"
16         /etc/init.d/privoxy restart
17 else
18         # only start if enabled
19         /etc/init.d/privoxy enabled && /etc/init.d/privoxy start
20 fi