wok view squid/stuff/etc/init.d/squid @ rev 20896

updated ethtool (4.2 -> 4.19)
author Hans-G?nter Theisgen
date Tue Feb 26 14:11:25 2019 +0100 (2019-02-26)
parents 1b6281d68d9f
children
line source
1 #!/bin/sh
2 # /etc/init.d/squid : Start, stop and restart Squid proxy server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start Squid proxy server at boot time, just put squid in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Squid
12 DESC="$(_ 'Squid proxy server')"
13 DAEMON=/usr/sbin/squid
14 OPTIONS=$SQUID_OPTIONS
15 PIDFILE=/var/run/squid.pid
16 http_port=$(grep ^http_port /etc/squid/squid.conf | awk '{print $2}')
17 [ -n "$http_port" ] || http_port=3128
18 [ -n "$OPTIONS" ] || OPTIONS="-a $http_port"
20 case "$1" in
21 start)
22 if active_pidfile $PIDFILE squid ; then
23 _ '%s is already running.' $NAME
24 exit 1
25 fi
26 cache_dir=$(grep ^cache_dir /etc/squid/squid.conf | awk '{print $3}')
27 [ -n "$cache_dir" ] || cache_dir=/var/cache
28 if [ -d "$cache_dir" -a ! -d "$cache_dir/00" ]; then
29 action 'Creating squid spool directory structure'
30 $DAEMON -z >/dev/null 2>&1
31 status
32 fi
33 action 'Starting %s: %s...' "$DESC" $NAME
34 $DAEMON $OPTIONS
35 status
36 sleep 2
37 ;;
38 stop)
39 if ! active_pidfile $PIDFILE squid ; then
40 _ '%s is not running.' $NAME
41 exit 1
42 fi
43 action 'Stopping %s: %s...' "$DESC" $NAME
44 $DAEMON -k kill
45 status
46 rm -f $PIDFILE
47 sleep 2
48 ;;
49 reload)
50 if ! active_pidfile $PIDFILE squid ; then
51 _ '%s is not running.' $NAME
52 exit 1
53 fi
54 action 'Reloading %s configuration...' $NAME
55 $DAEMON -k reconfigure
56 status
57 ;;
58 restart)
59 if ! active_pidfile $PIDFILE squid ; then
60 _ '%s is not running.' $NAME
61 exit 1
62 fi
63 action 'Restarting %s: %s...' "$DESC" $NAME
64 $DAEMON -k kill && $DAEMON $OPTIONS
65 status
66 sleep 2
67 ;;
68 *)
69 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
70 newline
71 exit 1
72 ;;
73 esac
75 exit 0