Lines 29-34
Link Here
|
29 |
|
29 |
|
30 |
SQUID=/usr/sbin/squid |
30 |
SQUID=/usr/sbin/squid |
31 |
SQUID_ULIMIT=4096 |
31 |
SQUID_ULIMIT=4096 |
|
|
32 |
SQUID_SHUTDOWN_TIMEOUT=60 |
32 |
SQUID_CONF="/etc/squid/squid.conf" |
33 |
SQUID_CONF="/etc/squid/squid.conf" |
33 |
|
34 |
|
34 |
# Overwrite something |
35 |
# Overwrite something |
Lines 39-44
Link Here
|
39 |
LOCKFILE=/var/lock/subsys/squid |
40 |
LOCKFILE=/var/lock/subsys/squid |
40 |
PIDFILE="$(sed -rn '/^[[:blank:]]*pid_filename[[:blank:]]/s/^[[:blank:]]*pid_filename[[:blank:]]+([^[:blank:]])+[[:blank:]]*$/\1/' "$SQUID_CONF")" |
41 |
PIDFILE="$(sed -rn '/^[[:blank:]]*pid_filename[[:blank:]]/s/^[[:blank:]]*pid_filename[[:blank:]]+([^[:blank:]])+[[:blank:]]*$/\1/' "$SQUID_CONF")" |
41 |
PIDFILE="${PIDFILE:-/var/run/squid.pid}" |
42 |
PIDFILE="${PIDFILE:-/var/run/squid.pid}" |
|
|
43 |
SQUIDUSER="$(sed -rn '/^[[:blank:]]*cache_effective_user[[:blank:]]/s/^[[:blank:]]*cache_effective_user[[:blank:]]+([^[:blank:]])+[[:blank:]]*$/\1/' "$SQUID_CONF")" |
44 |
SQUIDUSER="${SQUIDUSER:-squid}" |
42 |
RETVAL=0 |
45 |
RETVAL=0 |
43 |
|
46 |
|
44 |
start() |
47 |
start() |
Lines 61-74
Link Here
|
61 |
|
64 |
|
62 |
stop() |
65 |
stop() |
63 |
{ |
66 |
{ |
64 |
local p=$(cat "$PIDFILE" 2>/dev/null) |
67 |
local p=$(cat "$PIDFILE" 2>/dev/null) t |
65 |
if start-stop-daemon -q --pid "$PIDFILE" --user squid --stop --test >/dev/null; then |
68 |
if start-stop-daemon -q --pid "$PIDFILE" --user $SQUIDUSER --stop --test >/dev/null; then |
66 |
msg_stopping squid |
69 |
msg_stopping squid |
67 |
$SQUID -f "$SQUID_CONF" -k shutdown |
70 |
$SQUID -f "$SQUID_CONF" -k shutdown |
68 |
RETVAL=$? |
71 |
RETVAL=$? |
69 |
if [ $RETVAL = 0 ]; then |
72 |
if [ $RETVAL = 0 ]; then |
70 |
while [ "x$(LANG=C stat -c "%U %F" /proc/$p 2>/dev/null)" = "xsquid directory" ]; do |
73 |
t=0 |
|
|
74 |
while [ "x$(LANG=C stat -c "%U %F" /proc/$p 2>/dev/null)" = "x$SQUIDUSER directory" ]; do |
71 |
sleep 1 |
75 |
sleep 1 |
|
|
76 |
if [ $t -ge $SQUID_SHUTDOWN_TIMEOUT ]; then |
77 |
echo -n "timeout!" |
78 |
failure |
79 |
return 1 |
80 |
fi |
81 |
let t=$t+1 |
72 |
done |
82 |
done |
73 |
rm -f "$LOCKFILE" |
83 |
rm -f "$LOCKFILE" |
74 |
success |
84 |
success |
Lines 120-126
Link Here
|
120 |
[ -e "$LOCKFILE" ] && reload |
130 |
[ -e "$LOCKFILE" ] && reload |
121 |
;; |
131 |
;; |
122 |
status) |
132 |
status) |
123 |
status --pidfile "$PIDFILE" --expect-user squid squid |
133 |
status --pidfile "$PIDFILE" --expect-user $SQUIDUSER squid |
124 |
RETVAL=$? |
134 |
RETVAL=$? |
125 |
;; |
135 |
;; |
126 |
*) |
136 |
*) |