February 2011
Intermediate to advanced
332 pages
9h 3m
English
We are going to use a simple shell script, as shown in the following example, which takes a single command line argument and acts accordingly:
#!/bin/bash # init script to control Squid server case "$1" in start) /opt/squid/sbin/squid ;; stop) /opt/squid/sbin/squid -k shutdown ;; reload) /opt/squid/sbin/squid -k reconfigure ;; restart) /opt/squid/sbin/squid -k shutdown sleep 2 /opt/squid/sbin/squid ;; *) echo $"Usage: $0 {start|stop|reload|restart}" exit 2 esac exit $?
Please note the absolute path to the Squid executable here and change it accordingly. We can save this shell script to a file with the name squid and then move it to one of the directories we discussed earlier depending on our ...
Read now
Unlock full access