mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
* xs- goes to iiab- * more xs->iiab * sysconfig was forgotten * hyphen vs underscore i roles network templates * bulk sed on pgsql-xs * create links for old script names * missed named-xs -> named-iiab * squid-xs ->squid-iiab * misspelled squid-iiab.conf.j2
41 lines
1.1 KiB
Django/Jinja
Executable file
41 lines
1.1 KiB
Django/Jinja
Executable file
#!/bin/bash
|
|
# Turn squid caching on/off
|
|
|
|
SQUID_CACHEDIR="/library/cache"
|
|
SQUID_USER="squid:squid"
|
|
|
|
if [[ $1 == "enable" ]]; then
|
|
# Make sure that the cache directory is present.
|
|
# Squid crashes if it isn't (although it will create all subdirs...)
|
|
if [ ! -d $SQUID_CACHEDIR ]; then
|
|
mkdir $SQUID_CACHEDIR
|
|
chown $SQUID_USER $SQUID_CACHEDIR
|
|
/usr/sbin/squid -f /etc/squid/squid-iiab.conf -z
|
|
fi
|
|
|
|
# Turn squid on after the next reboot
|
|
/sbin/chkconfig --levels 345 squid on
|
|
# Turn squid on now
|
|
/sbin/service squid start
|
|
|
|
# Now, copy in a set of iptables that redirects forwarded traffic
|
|
# to port 80 to port 3128 on this machine
|
|
touch /etc/sysconfig/xs_httpcache_on
|
|
/sbin/service iptables restart
|
|
elif [[ $1 == "disable" ]]; then
|
|
# First, restore a normal set of iptables
|
|
if [ -e /etc/sysconfig/xs_httpcache_on ];then
|
|
rm /etc/sysconfig/xs_httpcache_on
|
|
fi
|
|
/sbin/service iptables restart
|
|
|
|
# Turn it off now
|
|
/sbin/service squid stop
|
|
# Turn it off after the next reboot
|
|
/sbin/chkconfig squid off
|
|
else
|
|
echo "Unrecognised argument: $1" >&2
|
|
exit 1
|
|
fi
|
|
|
|
|