wok-6.x view squid/stuff/etc/init.d/squid @ rev 16467

R-Pi: add gst-omx, libbcm2835, picamera, rcswitch-pi
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 22 02:07:08 2014 +0200 (2014-04-22)
parents f75355f3437e
children 7f188676b59c
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 echo "$NAME already running."
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 echo -n "Creating squid spool directory structure"
30 $DAEMON -z > /dev/null 2>&1
31 status
32 fi
33 echo -n "Starting $DESC: $NAME... "
34 $DAEMON $OPTIONS
35 status
36 sleep 2
37 ;;
38 stop)
39 if ! active_pidfile $PIDFILE squid ; then
40 echo "$NAME is not running."
41 exit 1
42 fi
43 echo -n "Stopping $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 echo "$NAME is not running."
52 exit 1
53 fi
54 echo -n "Reloading $DESC configuration... "
55 $DAEMON -k reconfigure
56 status
57 ;;
58 restart)
59 if ! active_pidfile $PIDFILE squid ; then
60 echo "$NAME is not running."
61 exit 1
62 fi
63 echo -n "Restarting $DESC: $NAME... "
64 $DAEMON -k kill && $DAEMON $OPTIONS
65 status
66 sleep 2
67 ;;
68 *)
69 echo ""
70 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|reload|restart]"
71 echo ""
72 exit 1
73 ;;
74 esac
76 exit 0