]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/init.d/squid
2 # Begin $rc_base/init.d/squid
7 chown
-R squid
:squid
/var
/log
/squid
8 chown
-R squid
:squid
/var
/log
/squidGuard
14 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
15 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/proxy
/settings
)
17 # If the proxy port is not set we set the default to 800.
18 if [ -z "${TRANSPARENT_PORT}" ]; then
22 LOCALIP
=`cat /var/ipfire/red/local-ipaddress | tr -d \n`
23 if [ -z $LOCALIP ]; then
24 boot_mesg
"Couldn't read local-ipaddress" ${FAILURE}
29 FILE
=/var
/ipfire
/vpn
/config
33 CONN_TYPE
=`echo "$LINE" | awk -F, '{ print $5 }'`
34 if [ "$CONN_TYPE" != "net" ]; then
37 iptables
-t nat
-A SQUID
-i $1 -p tcp
-d `echo "$LINE" | awk -F, '{ print $13 }'` --dport 80 -j RETURN
40 if [ "$RED_TYPE" == "STATIC" ]; then
41 iptables
-t nat
-A SQUID
-i $1 -p tcp
-d $RED_NETADDRESS/$RED_NETMASK --dport 80 -j RETURN
44 iptables
-t nat
-A SQUID
-i $1 -p tcp
-d $LOCALIP --dport 80 -j RETURN
46 iptables
-t nat
-A SQUID
-i $1 -p tcp
--dport 80 -j REDIRECT
--to-port "${TRANSPARENT_PORT}"
53 if [ -n "${pidlist}" ]; then
54 echo -e "Squid is already running with Process"\
55 "ID(s) ${pidlist}.${NORMAL}"
61 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/proxy
/advanced
/settings
)
62 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
64 if [ -e /var
/ipfire
/proxy
/enable -o -e /var
/ipfire
/proxy
/enable_blue
]; then
65 # Add Address to errorpage stylesheet
66 sed "s|XXXhostXXX|$GREEN_ADDRESS|g" /var
/ipfire
/proxy
/errorpage-
$ERR_DESIGN.css
> \
67 /etc
/squid
/errorpage.css
69 boot_mesg
"Creating Squid swap directories..."
70 /usr
/sbin
/squid
-z >/dev
/null
2>&1
73 # Make sure, that the process above has finished.
75 while [ ${counter} -gt 0 ]; do
76 if pidofproc
-s /usr
/sbin
/squid
; then
83 boot_mesg
"Starting Squid Proxy Server..."
84 loadproc
/usr
/sbin
/squid
87 if [ -e /var
/ipfire
/proxy
/transparent
]; then
88 transparent
$GREEN_DEV
90 if [ -e /var
/ipfire
/proxy
/transparent_blue
]; then
96 iptables
-t nat
-F SQUID
97 if [ -e /var
/run
/squid.pid
]; then
98 boot_mesg
"Stopping Squid Proxy Server..."
99 squid
-k shutdown
>/dev
/null
2>&1
102 # Stop squidGuard, updxlrator, squidclamav
103 # and redirect_wrappers.
104 killproc
/usr
/bin
/squidGuard
>/dev
/null
&
105 killproc
/usr
/sbin
/updxlrator
>/dev
/null
&
106 killproc
/usr
/bin
/squidclamav
>/dev
/null
&
107 killproc
/usr
/sbin
/redirect_wrapper
>/dev
/null
&
109 # Wait until all redirectors have been stopped.
112 # If squid is still running, wait up to 30 seconds
113 # before we go on to kill it.
116 while [ ${counter} -gt 0 ]; do
117 statusproc
/usr
/sbin
/squid
>/dev
/null
&& break;
119 counter
=$
(( ${counter} - 1))
122 # Kill squid service, if still running.
123 killproc
/usr
/sbin
/squid
>/dev
/null
125 # Trash remain pid file from squid.
126 rm -rf /var
/run
/squid.pid
137 /usr
/sbin
/squid
-k reconfigure
141 statusproc
/usr
/sbin
/squid
142 statusproc
/usr
/lib
/squid
/unlinkd
147 echo > /var
/log
/cache
/swap.state
148 chown squid.squid
/var
/log
/cache
/swap.state
153 chown
-R nobody.squid
/var
/updatecache
/
157 echo "Usage: $0 {start|stop|restart|status|flush}"
162 # End $rc_base/init.d/squid