Re: [squid-users] Help with running 2 instances of squid

2003-10-20 Thread Chris Wilcox

Hello,

I have three versions of squid running on the same machine, two in
production and one for development.  The best way that I found was to
have three entirely separate compiles for each version where I actually
change the names of the squid executables, config files, directory
structures, pids, ports, etc.  Then I fire them off independently with
separate init.d scripts (I work under linux).
BTW, I call different redirectors with each 'version' of squid.
I guess it depends on circumstances.  I originally thought of using seperate 
installs of Squid for each task, but we're working on a commercial product 
and really want to avoid the need to manage two packages for Squid instead 
of one.

The problem has been narrowed down to the second init.d script to start the 
second squid instance, as I can manually start each squid from the relevant 
conf file without error.

Thanks for the reply,

Regards,

nry

Murrah Boswell
Systems Administrator
Wild Apache Internet Services
Chris Wilcox wrote:

 Hi all,

 As far as I can tell, I have followed everything I'm supposed to have to
 make this work.  I wish to run two instances of Squid on the same 
machine:
 Squid/2.4.STABLE6 on Debian Woody stable.

 I have squid.conf and squid2.conf with the relevant settings altered.

 Squid.conf listens on port 3128 on the external IP.  I have not altered 
the
 PID file path for this one.
 Squid2.conf listens on port 8085 on 127.0.0.1  I have altered the PID 
file
 path to be /var/run/squid2.pid  I have created a different cache 
directory
 etc, and specified these within the squid2.conf file, along with 
checkong
 relevant permissions on these directories.

 I have then copied the squid init.d script and called this squid2.  I 
have
 altered squid2 to have a different name string, and altered all relevant
 entries within this script to point to the squid2 details eg cache 
directory
 etc.  This squid2 script is set to use 'squid2.pid' as I've specified in
 squid2.conf

 Yet still, when I do 'squid2 start' it always returns 'Squid is already
 running!  Process ID 213'

 I'm now lost.  Am I missing something really obvious here?  I've been 
trying
 to get this going for a good few weeks now!

 Major thanks for any advice and suggestions!

 Regards,

 nry

 _
 Use MSN Messenger to send music and pics to your friends
 http://www.msn.co.uk/messenger
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger



[squid-users] Help with running 2 instances of squid

2003-10-18 Thread Chris Wilcox
Hi all,

As far as I can tell, I have followed everything I'm supposed to have to 
make this work.  I wish to run two instances of Squid on the same machine: 
Squid/2.4.STABLE6 on Debian Woody stable.

I have squid.conf and squid2.conf with the relevant settings altered.

Squid.conf listens on port 3128 on the external IP.  I have not altered the 
PID file path for this one.
Squid2.conf listens on port 8085 on 127.0.0.1  I have altered the PID file 
path to be /var/run/squid2.pid  I have created a different cache directory 
etc, and specified these within the squid2.conf file, along with checkong 
relevant permissions on these directories.

I have then copied the squid init.d script and called this squid2.  I have 
altered squid2 to have a different name string, and altered all relevant 
entries within this script to point to the squid2 details eg cache directory 
etc.  This squid2 script is set to use 'squid2.pid' as I've specified in 
squid2.conf

Yet still, when I do 'squid2 start' it always returns 'Squid is already 
running!  Process ID 213'

I'm now lost.  Am I missing something really obvious here?  I've been trying 
to get this going for a good few weeks now!

Major thanks for any advice and suggestions!

Regards,

nry

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger



Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Schelstraete Bart
HEllo,

Are you also starting the squid with the other configuration file?
(squid -f  [configile])
  Bart

Chris Wilcox wrote:

Hi all,

As far as I can tell, I have followed everything I'm supposed to have 
to make this work.  I wish to run two instances of Squid on the same 
machine: Squid/2.4.STABLE6 on Debian Woody stable.

I have squid.conf and squid2.conf with the relevant settings altered.

Squid.conf listens on port 3128 on the external IP.  I have not 
altered the PID file path for this one.
Squid2.conf listens on port 8085 on 127.0.0.1  I have altered the PID 
file path to be /var/run/squid2.pid  I have created a different cache 
directory etc, and specified these within the squid2.conf file, along 
with checkong relevant permissions on these directories.

I have then copied the squid init.d script and called this squid2.  I 
have altered squid2 to have a different name string, and altered all 
relevant entries within this script to point to the squid2 details eg 
cache directory etc.  This squid2 script is set to use 'squid2.pid' as 
I've specified in squid2.conf

Yet still, when I do 'squid2 start' it always returns 'Squid is 
already running!  Process ID 213'

I'm now lost.  Am I missing something really obvious here?  I've been 
trying to get this going for a good few weeks now!

Major thanks for any advice and suggestions!

Regards,

nry

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger






Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Chris Wilcox

Are you also starting the squid with the other configuration file?
(squid -f  [configile])
The init.d script for squid2 is pasted below:

**Start of script***

#! /bin/sh
#
# squid Startup script for the SQUID HTTP proxy-cache.
#
# Version:  @(#)squid.rc  2.20  01-Oct-2001  [EMAIL PROTECTED]
#
NAME=squid2
DAEMON=/usr/sbin/squid
LIB=/usr/lib/squid
PIDFILE=/var/run/$NAME.pid
SQUID_ARGS=-D -sYC -f /etc/squid2.conf
[ ! -f /etc/default/squid2 ] || . /etc/default/squid2

PATH=/bin:/usr/bin:/sbin:/usr/sbin

[ -x $DAEMON ] || exit 0

grepconf2 () {
   w=  # space tab
   sq=/etc/$NAME.conf
   # sed is cool.
   res=`sed -ne '
   
s/^'$1'['$w']\+[^'$w']\+['$w']\+\([^'$w']\+\).*$/\1/p;
   t end;
   d;
   :end q'  $sq`
   [ -n $res ] || res=$2
   echo $res
}

#
#   Try to increase the # of filedescriptors we can open.
#
maxfds () {
   [ -n $SQUID_MAXFD ] || return
   [ -f /proc/sys/fs/file-max ] || return 0
   [ $SQUID_MAXFD -le 4096 ] || SQUID_MAXFD=4096
   global_file_max=`cat /proc/sys/fs/file-max`
   minimal_file_max=$(($SQUID_MAXFD + 4096))
   if [ $global_file_max -lt $minimal_file_max ]
   then
   echo $minimal_file_max  /proc/sys/fs/file-max
   fi
   ulimit -n $SQUID_MAXFD
}
start () {
   cdr=`grepconf2 cache_dir /var/spool/squid/$NAME`
   case $cdr in
   [0-9]*)
   echo squid: squid2.conf contains 2.2.5 syntax - not 
starting! 2
   exit 1
   ;;
   esac
   maxfds
   umask 027
   cd $cdr
   start-stop-daemon --quiet --start \
   --pidfile $PIDFILE \
   --exec $DAEMON -- $SQUID_ARGS  /dev/null
   sleep 1
}

stop () {
   PID=`cat $PIDFILE 2/dev/null`
   start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
   #
   #   Now we have to wait until squid has _really_ stopped.
   #
   sleep 2
   if test -n $PID  kill -0 $PID 2/dev/null
   then
   echo -n Waiting .
   cnt=0
   while kill -0 $PID 2/dev/null
   do
   cnt=`expr $cnt + 1`
   if [ $cnt -gt 60 ]
   then
   #
   #   Waited 120 seconds now. Fail.
   #
   echo -n  Failed.. 
   break
   fi
   sleep 2
   echo -n .
   done
   [ $1 = verbose ]  echo done.
   else
   [ $1 = verbose ]  echo $NAME.
   fi
}
case $1 in
   start)
   echo -n Starting proxy server: 
   start
   echo $NAME.
   ;;
   stop)
   echo -n Stopping proxy server: 
   stop verbose
   ;;
   reload|force-reload)
   echo Reloading $NAME configuration files
   start-stop-daemon --stop --signal 1 \
   --pidfile $PIDFILE --quiet --exec $DAEMON
   ;;
   restart)
   echo Restarting proxy server: 
   stop
   start
   echo $NAME.
   ;;
   *)
   echo Usage: /etc/init.d/$NAME 
{start|stop|reload|force-reload|restart}
   exit 1
   ;;
esac

exit 0

***End of 
Script

it makes no difference to the error message by adding or removing the '-f 
/etc/squid2.conf' to the parameters at the top of the script.

Thanks again for further help,

Regards,

nry


Chris Wilcox wrote:

Hi all,

As far as I can tell, I have followed everything I'm supposed to have to 
make this work.  I wish to run two instances of Squid on the same machine: 
Squid/2.4.STABLE6 on Debian Woody stable.

I have squid.conf and squid2.conf with the relevant settings altered.

Squid.conf listens on port 3128 on the external IP.  I have not altered 
the PID file path for this one.
Squid2.conf listens on port 8085 on 127.0.0.1  I have altered the PID file 
path to be /var/run/squid2.pid  I have created a different cache directory 
etc, and specified these within the squid2.conf file, along with checkong 
relevant permissions on these directories.

I have then copied the squid init.d script and called this squid2.  I have 
altered squid2 to have a different name string, and altered all relevant 
entries within this script to point to the squid2 details eg cache 
directory etc.  This squid2 script is set to use 'squid2.pid' as I've 
specified in squid2.conf

Yet still, when I do 'squid2 start' it always returns 'Squid is already 
running!  Process ID 213'

I'm now lost.  Am I missing something really obvious here?  I've been 
trying to get this going for a good few weeks now!

Major thanks for any advice and suggestions!

Regards,

nry


Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Chris Wilcox
Ok, if I manually start the squid instances using 'squid -f /etc/squid.conf' 
and 'squid -f /etc/squid2.conf' then it all works correcttly.  I'm therefire 
guessing that I haven't edited the init.d script correctly!]

Any pointers based on the script I posted in my previous message?

Thanks and regards,

nry


HEllo,

Are you also starting the squid with the other configuration file?
(squid -f  [configile])
  Bart

Chris Wilcox wrote:

Hi all,

As far as I can tell, I have followed everything I'm supposed to have to 
make this work.  I wish to run two instances of Squid on the same machine: 
Squid/2.4.STABLE6 on Debian Woody stable.

I have squid.conf and squid2.conf with the relevant settings altered.

Squid.conf listens on port 3128 on the external IP.  I have not altered 
the PID file path for this one.
Squid2.conf listens on port 8085 on 127.0.0.1  I have altered the PID file 
path to be /var/run/squid2.pid  I have created a different cache directory 
etc, and specified these within the squid2.conf file, along with checkong 
relevant permissions on these directories.

I have then copied the squid init.d script and called this squid2.  I have 
altered squid2 to have a different name string, and altered all relevant 
entries within this script to point to the squid2 details eg cache 
directory etc.  This squid2 script is set to use 'squid2.pid' as I've 
specified in squid2.conf

Yet still, when I do 'squid2 start' it always returns 'Squid is already 
running!  Process ID 213'

I'm now lost.  Am I missing something really obvious here?  I've been 
trying to get this going for a good few weeks now!

Major thanks for any advice and suggestions!

Regards,

nry

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger




_
Express yourself with cool emoticons - download MSN Messenger today! 
http://www.msn.co.uk/messenger



Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Henrik Nordstrom
On Sat, 18 Oct 2003, Chris Wilcox wrote:

 Yet still, when I do 'squid2 start' it always returns 'Squid is already 
 running!  Process ID 213'

You only get this error if you try to start two Squids with the same 
pid_filename.

Regards
Henrik



Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Chris Wilcox

On Sat, 18 Oct 2003, Chris Wilcox wrote:

 Yet still, when I do 'squid2 start' it always returns 'Squid is already
 running!  Process ID 213'
You only get this error if you try to start two Squids with the same
pid_filename.
Which is what's confusing me! I copied the original squid start up script 
and believe I have edited it to start a second instance.  I have set 
pid_filename in the second 'squid2.conf' file to be a different pid_filename 
and the init.d script still gives the same error.  I'm guessing it's a fault 
with my editing of the script since if I start two squid's manually (squid 
-f /etc/squid.confandsquid -f /etc/squid2.conf) then it works 
without problems.

I posted the script to this list about an hour ago to see if someone can 
spot what I have missed.

Regards,

Chris

_
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile


Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Henrik Nordstrom
On Sat, 18 Oct 2003, Chris Wilcox wrote:

 and the init.d script still gives the same error.  I'm guessing it's a fault 
 with my editing of the script since if I start two squid's manually (squid 
 -f /etc/squid.confandsquid -f /etc/squid2.conf) then it works 
 without problems.

If starting Squid manually with -f arguments work fine then the Squid 
parts of things are done, and all that remains is to get the init scripts 
operating correctly.

Assuming the init scripts are shell scripts you may be able to trace what 
the script are doing by running it as sh -x /path/to/initscript start or 
by inserting set -x commands at carefully selected locations.

Regards
Henrik



Re: [squid-users] Help with running 2 instances of squid

2003-10-18 Thread Chris Wilcox

On Sat, 18 Oct 2003, Chris Wilcox wrote:

 and the init.d script still gives the same error.  I'm guessing it's a 
fault
 with my editing of the script since if I start two squid's manually 
(squid
 -f /etc/squid.confandsquid -f /etc/squid2.conf) then it works
 without problems.

If starting Squid manually with -f arguments work fine then the Squid
parts of things are done, and all that remains is to get the init scripts
operating correctly.
Assuming the init scripts are shell scripts you may be able to trace what
the script are doing by running it as sh -x /path/to/initscript start or
by inserting set -x commands at carefully selected locations.
Thanks Henrik, I'll give that a go.

As always I'll keep going till this works!

Regards,

nry

_
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile