Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-21-2012, 07:55 AM
|
#1
|
LQ Newbie
Registered: Jul 2007
Distribution: Sles
Posts: 10
Rep:
|
Multiple Instances of Squid on One Server
Good morning,
Using sles10sp4
I am trying to setup multiple instances of Squid on one server. I have done the following:
1. Created separate squid-bao folder under /etc/squid/
2. Created separate squid-bao.conf file under/etc/squid/squid-bao
3. Created a script to start this instance of squid which contains the following:
exec /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf $@
4. Created a /var/log/squid/squid-bao folder.
5. Created a /var/cache/squid/squid-bao folder.
I am seeing the following error messages when trying to start this instance of Squid:
Aug 21 07:36:36 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:36 twausoproxy03 squid[15555]: Squid Parent: child process 15583 exited due to signal 6
Aug 21 07:36:39 twausoproxy03 squid[15555]: Squid Parent: child process 15596 started
Aug 21 07:36:39 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:39 twausoproxy03 squid[15555]: Squid Parent: child process 15596 exited due to signal 6
Aug 21 07:36:42 twausoproxy03 squid[15555]: Squid Parent: child process 15609 started
Aug 21 07:36:42 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:42 twausoproxy03 squid[15555]: Squid Parent: child process 15609 exited due to signal 6
Aug 21 07:36:42 twausoproxy03 squid[15555]: Exiting due to repeated, frequent failures
Aug 21 07:45:23 twausoproxy03 syslog-ng[2370]: STATS: dropped 0
So I edited my startup script (squid-bao.sh) to include the -z switch
exec /usr/sbin/squid -z /etc/squid/BAO/squid-bao.conf $@
When I run the script it says it is creating the
2012/08/21 07:50:50| Creating Swap Directories
but when I go into the /var/cache/squid/squid-bao folder there are no folders. I have the following in the squid-bao.conf file:
cache_dir ufs /var/cache/squid/squid-bao 100 16 256
What am I doing wrong or what have I missed?
Scott
|
|
|
08-21-2012, 04:04 PM
|
#2
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,201
|
Quote:
So I edited my startup script (squid-bao.sh) to include the -z switch
exec /usr/sbin/squid -z /etc/squid/BAO/squid-bao.conf $@
|
I guess you have to run:
Code:
/usr/sbin/squid -z -f /etc/squid/BAO/squid-bao.conf
Please note that you need to run squid -z only once, so it creates the needed directory structure for its cache. After that start squid normally without the -z option.
Also note that the squid user must have r/w access to the cache directory.
Regards
|
|
|
08-22-2012, 08:30 AM
|
#3
|
LQ Newbie
Registered: Jul 2007
Distribution: Sles
Posts: 10
Original Poster
Rep:
|
That worked once I figured out the how to apply the correct rights to the squid-bao folder for the squid user. Thanks for the help!!
Scott
|
|
|
08-22-2012, 08:38 AM
|
#4
|
LQ Newbie
Registered: Jul 2007
Distribution: Sles
Posts: 10
Original Poster
Rep:
|
Now I have another question. Now that the bao instance is able to start and actually run. When I run the squid-bao.sh script to start this instance it also starts the original instance of squid that uses squid.conf. I want them to be totally separate. Is there another switch I should add to the script or a setting in the squid-bao.conf file I should set?
Also, how to stop each instance of Squid separately so I am not unloading both of them when I do not want to?
Thanks again,
Scott
|
|
|
08-22-2012, 12:08 PM
|
#5
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,201
|
Are you sure that the plain squid instance is started by your script? Normally it should start as a system service on boot, or using
Code:
service squid start
Same goes for stopping squid.
If you want to stop every instance independently from the other, you can use
Code:
/usr/sbin/squid -f /path/to/instance/squid.conf -k shutdown
Regards
|
|
|
08-23-2012, 09:24 AM
|
#6
|
LQ Newbie
Registered: Jul 2007
Distribution: Sles
Posts: 10
Original Poster
Rep:
|
If I do a ps -ef |grep squid before I run my start script I see this:
twausoproxy03:/etc/squid/BAO # ps -ef |grep squid
root 13739 12142 0 09:22 pts/0 00:00:00 grep squid
After running my script I see this:
twausoproxy03:/etc/squid/BAO # ps -ef |grep squid
root 13742 1 0 09:22 ? 00:00:00 /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf
squid 13744 13742 0 09:22 ? 00:00:00 (squid) -f /etc/squid/BAO/squid-bao.conf
squid 13745 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13746 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13747 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13748 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13749 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13750 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13751 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13752 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13753 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13754 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13755 13744 0 09:22 ? 00:00:00 (unlinkd)
root 13757 12142 0 09:22 pts/0 00:00:00 grep squid
This is my script:
root 13742 1 0 09:22 ? 00:00:00 /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf
squid 13744 13742 0 09:22 ? 00:00:00 (squid) -f /etc/squid/BAO/squid-bao.conf
The rest is the plain Squid instance.
Also that stop script does not work. I still see all of the instances running after I run the stop script.
Any suggestions?
Thanks
Scott
|
|
|
08-23-2012, 10:34 AM
|
#7
|
LQ Newbie
Registered: Jul 2007
Distribution: Sles
Posts: 10
Original Poster
Rep:
|
I got it figured out and what was causing me to see the regular Squid instance. It was not the reqular Squid instance I was seeing. So you were correct. To create the squid-bao.conf I copied the squid.conf file and I forgot to remove the method of authentication we are using with that Squid instance. Once I removed that it works fine. I also found that I had to add exec to the stop script, then shutdown worked.
exec /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf -k shutdown
Again, thanks for your help!
Scott
|
|
|
08-23-2012, 11:51 AM
|
#8
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,201
|
Glad to see you've done it.
Just a FYI: the "squid -k shutdown" is indeed working, but it takes some time for squid to stop, as it has to close the files opened for its cache. If you want to stop squid instantly you can use "kill" instead of "shutdown".
You may also mark the thread "Solved" from the "Thread Tools" on top of the page.
Cheers
|
|
|
All times are GMT -5. The time now is 05:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|