Line
Link Here
|
0 |
-- squid.initd.orig |
0 |
++ squid.initd |
Lines 9-24
depend() {
Link Here
|
9 |
need net |
9 |
need net |
10 |
} |
10 |
} |
11 |
|
11 |
|
|
|
12 |
upval() { |
13 |
[ -f $1 ] || return 0 |
14 |
if [ `cat $1` -lt $2 ]; then |
15 |
echo $2 > $1 |
16 |
fi |
17 |
} |
18 |
|
12 |
# Try to increase the # of filedescriptors we can open. |
19 |
# Try to increase the # of filedescriptors we can open. |
13 |
maxfds() { |
20 |
maxfds() { |
14 |
[ -n "$SQUID_MAXFD" ] || return |
21 |
[ -n "$SQUID_MAXFD" ] || return |
15 |
[ -f /proc/sys/fs/file-max ] || return 0 |
|
|
16 |
[ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 |
22 |
[ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 |
17 |
local global_file_max=`cat /proc/sys/fs/file-max` |
|
|
18 |
local minimal_file_max=$(($SQUID_MAXFD + 4096)) |
23 |
local minimal_file_max=$(($SQUID_MAXFD + 4096)) |
19 |
if [ "$global_file_max" -lt $minimal_file_max ]; then |
24 |
upval /proc/sys/fs/file-max $minimal_file_max || return 0 |
20 |
echo $minimal_file_max > /proc/sys/fs/file-max |
25 |
( /usr/sbin/squid -v|grep -q "\--disable-epoll" ) || upval /proc/sys/fs/epoll/max_user_watches $minimal_file_max |
21 |
fi |
|
|
22 |
ulimit -n $SQUID_MAXFD |
26 |
ulimit -n $SQUID_MAXFD |
23 |
} |
27 |
} |
24 |
|
28 |
|