Navigation
Records in this category
- Fedora 11 upgradation
- up2date tutorial
- RHEL5 Kickstart installation using HTTP
- LastLog Editor - Unix LogFiles
- How to enable the fingerprint reader in Linux
- How to use gnome-volume-manager in Gentoo linux
- How to break raid 1 Mirror in Linux ?
- How to set up local exchange server to receive email from my domain or website ?
- How to change file permissions in cpanel to 4755
- How to edit the DNS entries in Cpanel (WHM)
- How to configure Linux and Samba with roaming profile suport for windows clients
- How to restrict "rm -rf *" command in Linux/Unix ?
- How do I change IP Address of my linux machine
- How to check what version of Linux installed in my machine
- How do you open a TCP Port in Debian Linux?
- How to force Ubuntu to re-detect and re-configure Graphics chipset?
- How to mount NTFS file system in Redhat linux 9.0
- How to utomatically mount cd/dvd and usb rhel5?
- How to copy LARGE files using linux cp command ?
- How to find If my linux OS is 64 bit or 32 bit system
- How to mount network drives using Pam_mount.conf.xml?
- How do I compile Squid?
- How to build Squid on various OS
- How do I start Squid?
- How do I start Squid automatically when the system boots?
- How do I tell if Squid is running?
- What are the squid command line options
- Can Squid benefit from SMP systems?
- Is it okay to use separate drives for Squid?
- How do I configure Squid without re-compiling it?
- What does the squid.conf file do?
- How do I join a cache hierarchy in Squid ?
- How do I register my cache with NLANR's registration service?
- Why my cache registration is not appearing in the Tracker database.
- How do I configure Squid to work behind a firewall?
- How do I configure Squid forward all requests to another proxy?
- What ''cache_dir'' size should I use?
- I'm adding a new cache_dir. Will I lose my cache?
- Squid and http-gw from the TIS toolkit.
- What is "HTTP_X_FORWARDED_FOR"? Why does squid provide it to WWW servers, and how can I stop it?
- Can Squid anonymize HTTP requests?
- Can I make Squid go direct for some sites?
- Can I make Squid proxy only, without caching anything?
- Can I prevent users from downloading large files using squid?
- How do I add default gateway in RedHat 7.2
- I can't upgrade any packages, run up2date or rpm. What is wrong?
- What is the safest way how to repair rpm database
- Okay, I am convinced that RPM-based package management is worth exploring, but my (Unix|Linux|BSD|whatever) distribution does not ship a version already pre-built which I can just install.I have looked everywhere, and it is just not available.What should I do?
- How to Disable Ctrl + ALT + Del restart
- How to recover root password in Linux
- What are the User and Group management commands in (RHEL/CentOS/Fedora)
- How to configure a samba file server in Linux
Tags
Sticky FAQs
Linux
How do I start Squid automatically when the system boots?
Squid has a restart feature built in. This greatly simplifies starting Squid and means that you don't need to use RunCache or inittab. At the minimum, you only need to enter the pathname to the Squid executable. For example: Squid will automatically background itself and then spawn a child process. In your syslog messages file, you should see something like this: That means that process ID 14563 is the parent process which monitors the child process (pid 14617). The child process is the one that does all of the work. The parent process just waits for the child process to exit. If the child process exits unexpectedly, the parent will automatically start another child process. In that case, syslog shows: If there is some problem, and Squid can not start, the parent process will give up after a while. Your syslog will show: When this happens you should check your syslog messages and cache.log file for error messages. When you look at a process (ps command) listing, you'll see two squid processes: The first is the parent process, and the child process is the one called "(squid)". Note that if you accidentally kill the parent process, the child process will not notice. If you want to run Squid from your termainal and prevent it from backgrounding and spawning a child process, use the -N command line option. On systems which have an /etc/inittab file (Digital Unix, Solaris, IRIX, HP-UX, Linux), you can add a line like this: We recommend using a squid.sh shell script, but you could instead call Squid directly with the -N option and other options you may require. A samplesquid.sh script is shown below: On BSD-ish systems, you will need to start Squid from the "rc" files, usually /etc/rc.local. For example: Squid ships with a init.d type startup script in contrib/squid.rc which works on most init.d type systems. Or you can write your own using any normal init.d script found in your system as template and add the start/stop fragments shown below. Start: Stop: Create squid service directory, and the log directory (if it does not exist yet). Then, change to the service directory, and create 2 executable scripts: run and log/run. Finally, start the squid service by linking it into svscan monitored area. Squid should start within 5 seconds./usr/local/squid/sbin/squid
Sep 23 23:55:58 kitty squid[14616]: Squid Parent: child process 14617 started
Sep 23 23:56:02 kitty squid[14616]: Squid Parent: child process 14617 exited with status 1
Sep 23 23:56:05 kitty squid[14616]: Squid Parent: child process 14619 started
Sep 23 23:56:12 kitty squid[14616]: Exiting due to repeated, frequent failures
24353 ?? Ss 0:00.00 /usr/local/squid/bin/squid
24354 ?? R 0:03.39 (squid) (squid)
/usr/local/squid/bin/squid -N
from inittab
sq:3:respawn:/usr/local/squid/sbin/squid.sh < /dev/null >> /tmp/squid.log 2>&1
C=/usr/local/squid
PATH=/usr/bin:$C/bin
TZ=PST8PDT
export PATH TZ
# User to notify on restarts
notify="root"
# Squid command line options
opts=""
cd $C
umask 022
sleep 10
while [ -f /var/run/nosquid ]; do
sleep 1
done
/usr/bin/tail -20 $C/logs/cache.log
| Mail -s "Squid restart on ´hostname´ at ´date´" $notify
exec bin/squid -N $opts
from rc.local
if [ -f /usr/local/squid/sbin/squid ]; then
echo -n ' Squid'
/usr/local/squid/sbin/squid
fi
from init.d
/usr/local/squid/sbin/squid
/usr/local/squid/sbin/squid -k shutdown
n=120
while /usr/local/squid/sbin/squid -k check && [ $n -gt 120 ]; do
sleep 1
echo -n .
n=´expr $n - 1´
done
with daemontools
mkdir -p /usr/local/squid/supervise/log /var/log/squid
chown squid /var/log/squid
cd /usr/local/squid/supervise
rm -f /var/run/squid/squid.pid
exec /usr/local/squid/sbin/squid -N 2>&1
exec /usr/local/bin/multilog t /var/log/squid
cd /service
ln -s /usr/local/squid/supervise squid
Tags: linux, squid automatic, squid automatic proxy
Related entries:
- How to rebuild Solaris Device Tree
- Installing and Configuring MySQL on Solaris 10 with Service Management Facility
- Fedora 11 upgradation
- up2date tutorial
- RHEL5 Kickstart installation using HTTP
Last update: 2009-07-25 08:16
AuthorLuke Francis
Revision: 1.0
You cannot comment on this entry