#!/bin/sh sleep 10; export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" [ ! -f /etc/default/squid ] || . /etc/default/squid NAME=squid DAEMON=/usr/sbin/squid #ARGS="-D -sNYC" ARGS="-D -sNY" CHUID="${CHUID:=proxy}" # # Try to increase the # of filedescriptors we can open. # maxfds () { # {{{ [ -n "$SQUID_MAXFD" ] || return [ -f /proc/sys/fs/file-max ] || return 0 [ $SQUID_MAXFD -le 4096 ] || SQUID_MAXFD=4096 global_file_max=`cat /proc/sys/fs/file-max` minimal_file_max=$(($SQUID_MAXFD + 4096)) if [ "$global_file_max" -lt $minimal_file_max ] then echo $minimal_file_max > /proc/sys/fs/file-max fi ulimit -n $SQUID_MAXFD } # }}} grepconf2 () { # {{{ w=" " # space tab sq=/etc/squid/$NAME.conf # sed is cool. res=`sed -ne ' s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q' < $sq` [ -n "$res" ] || res=$2 echo "$res" } # }}} cdr=`grepconf2 cache_dir /var/spool/$NAME` umask 027 cd $cdr exec 2>&1 echo "Starting proxy server: squid" exec su - $CHUID -c "$DAEMON $ARGS" # vim600: fdm=marker fdl=0 fdc=3