RE: [PHP] PID needed to hammer squid

2004-08-27 Thread Thijs Lensselink
To get the pid id:

?php
  exec(cat [path to pid file], $pid); echo $pid[0];
?

raditha dissanayake wrote:
 Mário Gamito wrote:
 
 Hi,
 
 I need to kill (squid) -D
 pidof (squid) -D gives an error :(
 
 man pidof
 we have nowed moved to off topic territory.
 
 
 --
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ |
 http://www.raditha.com/megaupload Lean and mean Secure FTP applet
 with | Mega Upload - PHP file uploader Graphical User Inteface. Just
 128 KB | with progress bar. 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PID needed to hammer squid

2004-08-25 Thread Jay Blanchard
[snip]
I need to restart squid from PHP, but my squi doesn't stop because a lot 
of stupid errors.

So, i need to kill it and then start it again.

[EMAIL PROTECTED] init.d]# ps aux | grep squid
root  9281  0.0  0.3  6124 1792 ?S16:04   0:00 squid -D
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
squid 9284  0.0  0.0  1360  264 ?S16:04   0:00 (unlinkd)
root  9288  0.0  0.1  3860  592 pts/0S16:10   0:00 grep squid
[EMAIL PROTECTED] init.d]# echo $$;

The pid i need to kill is the one from the line:

squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

How can i get this pid so i can kill -9 it and then start squid again ?
[/snip]

Start here http://www.php.net/exec
To get the PID you may be able to place the output of ps -aux in an array, regex for 
what you want, then exec

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PID needed to hammer squid

2004-08-25 Thread raditha dissanayake
Mário Gamito wrote:
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a 
lot of stupid errors.

So, i need to kill it and then start it again.
killing a process owned by another user is a tough ask. The squid docs 
say you shouldn't run it as root and it also advice against using nobody 
- the user that typically own the apache process. How to make use of 
sudo/suexec/cron to overcome these issues have been discussed often in 
the past and you will find it in the archives.

To answer your specific question on getting the PID. I would try looking 
in /var/run/squid.pid or executing `pidof squid`
instead of trying to parse the output of ps.


squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PID needed to hammer squid

2004-08-25 Thread Mário Gamito
Hi,
I need to kill (squid) -D
pidof (squid) -D gives an error :(
Regards,
Mário Gamito
raditha dissanayake wrote:
Mário Gamito wrote:
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a 
lot of stupid errors.

So, i need to kill it and then start it again.

killing a process owned by another user is a tough ask. The squid docs 
say you shouldn't run it as root and it also advice against using nobody 
- the user that typically own the apache process. How to make use of 
sudo/suexec/cron to overcome these issues have been discussed often in 
the past and you will find it in the archives.

To answer your specific question on getting the PID. I would try looking 
in /var/run/squid.pid or executing `pidof squid`
instead of trying to parse the output of ps.


squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PID needed to hammer squid

2004-08-25 Thread raditha dissanayake
Mário Gamito wrote:
Hi,
I need to kill (squid) -D
pidof (squid) -D gives an error :(
man pidof
we have nowed moved to off topic territory.
--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php