In this case you may run squid -DVY at your slackware console to run squid proxy server as daemon. So, i’ve modified this script for grouping your script in /etc/rc.d/…
First, make sure your squid bin is in /usr/sbin/squid or located your selft with “wich squid” command and than copy this entire script to your /etc/rc.d/rc.squid
cat > /etc/rc.d/rc.squid << “EOF”
#!/bin/bash
SQUID_OPTS=”-DVY”
# determine the name of the squid binary
[ -f /usr/sbin/squid ] && SQUID=squid
[ -z "$SQUID" ] && exit 0
prog=”$SQUID”
# determine which one is the cache_swap directory
CACHE_SWAP=`sed -e ’s/#.*//g’ /etc/squid/squid.conf | \
grep cache_dir | awk ‘{ print $3 }’`
[ -z "$CACHE_SWAP" ]
RETVAL=0
start() {
for adir in $CACHE_SWAP; do
if [ ! -d $adir/00 ]; then
echo -n “init_cache_dir $adir… “
$SQUID -z -F 2>/dev/null
fi
done
echo -n $”Starting $prog: “
$SQUID $SQUID_OPTS 2> /dev/null &
RETVAL=$?
touch /var/lock/subsys/$SQUID
echo
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: “
$SQUID -k shutdown
echo
rm -f /var/lock/subsys/$SQUID
}
reload() {
$SQUID $SQUID_OPTS -k reconfigure
}
restart() {
stop
sleep 10
start
}
case “$1″ in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
*)
echo $”Usage: $0 {start|stop|reload|restart}”
exit 1
esac
exit $?
EOF
chmod +x /etc/rc.d/rc.squid
/etc/rc.d.rc.squid start
No Comments Yet
No comments yet.
Comments RSS TrackBack Identifier URI
Leave a comment
