#!/bin/sh DAEMON=squid PID_FILE=/var/run/squid/$DAEMON.pid . /etc/init.d/modlibrc config() { # logfiles rm -f /var/log/squid_*.log 2>/dev/null for logfile in access cache store; do ln -sf $SQUID_LOG_DIR${logfile}.log /var/log/squid_${logfile}.log done #directories for dirs in $SQUID_LOG_DIR $SQUID_CACHE_DIR $SQUID_COREDUMP_DIR; do [ -d $dirs ] && continue mkdir $dirs chown squid:squid $dirs done # modlib_config } start() { modlib_startdaemon $DAEMON_BIN -f $DAEMON_CONFIG } stop() { $DAEMON_BIN -f $DAEMON_CONFIG -k shutdown } reload() { $DAEMON_BIN -f $DAEMON_CONFIG -k reconfigure } case $1 in ""|load) modlib_add_user_and_group $DAEMON mkdir -p ${PID_FILE%/*} chown $DAEMON:$DAEMON ${PID_FILE%/*} modreg cgi $DAEMON Squid modreg daemon $DAEMON modreg status $DAEMON Squid ${DAEMON}_log modlib_start $DAEMON_ENABLED ;; unload) modunreg status $DAEMON ${DAEMON}_log modunreg daemon $DAEMON modunreg cgi $DAEMON modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; reload) modlib_reload ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|restart|reload|status]" 1>&2 exit 1 ;; esac exit 0