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

Fix: DEPENDS in claws-mail
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Aug 28 23:01:04 2008 +0200 (2008-08-28)
parents
children f75355f3437e
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 [ -f $PIDFILE ] ; 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
31 status
32 fi
33 echo -n "Starting $DESC: $NAME... "
34 $DAEMON $OPTIONS
35 status
36 sleep 2
37 ;;
38 stop)
39 if [ ! -f $PIDFILE ] ; then
40 echo "$NAME is not running."
41 exit 1
42 fi
43 echo -n "Stopping $DESC: $NAME... "
44 kill `cat $PIDFILE`
45 status
46 sleep 2
47 ;;
48 restart)
49 if [ ! -f $PIDFILE ] ; then
50 echo "$NAME is not running."
51 exit 1
52 fi
53 echo -n "Restarting $DESC: $NAME... "
54 kill `cat $PIDFILE`
55 sleep 2
56 $DAEMON $OPTIONS
57 status
58 sleep 2
59 ;;
60 *)
61 echo ""
62 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
63 echo ""
64 exit 1
65 ;;
66 esac
68 exit 0