Re: sysctl kern.maxproc help needed

2007-05-01 Thread Ted Unangst

On 5/1/07, Daniel Ouellet [EMAIL PROTECTED] wrote:

I was testing the effect of sysctl kern.maxproc=xxx to see if I could
figure out the memory usage of httpd until I get my additional memory in
the server as it's in order and I don't have it yet.

But now, I have more process running then the kern.maxproc value and I
can't even to pkill httpd for example as it gets

sh: cannot fork - try again.


kill is a shell builtin and doesn't need to fork.



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Daniel Ouellet

Ted Unangst wrote:

On 5/1/07, Daniel Ouellet [EMAIL PROTECTED] wrote:

I was testing the effect of sysctl kern.maxproc=xxx to see if I could
figure out the memory usage of httpd until I get my additional memory in
the server as it's in order and I don't have it yet.

But now, I have more process running then the kern.maxproc value and I
can't even to pkill httpd for example as it gets

sh: cannot fork - try again.


kill is a shell builtin and doesn't need to fork.


Yes, I can use it, but I can't figure out the process ID. I am trying to 
understand the man page on this to kill the group 67, or www.


Obviously, I can't figure out the proper use of that syntax here.

Man said

The following PIDs have special meanings:
-1  If superuser, broadcast the signal to all processes; other-
wise, broadcast to all processes belonging to the user.
-pgid   Send the signal to all processes within the specified pro-
cess group.

But so far I am not successful yet anyway.

Looks like I can't figure out the syntax for killing the full group www 
or 67.


OK

I am sure it's stupid, but never use it once yet and the man page are 
not clear for me to understand it properly.




Re: sysctl kern.maxproc help needed

2007-05-01 Thread Ted Unangst

On 5/1/07, Daniel Ouellet [EMAIL PROTECTED] wrote:

Ted Unangst wrote:
 On 5/1/07, Daniel Ouellet [EMAIL PROTECTED] wrote:
 I was testing the effect of sysctl kern.maxproc=xxx to see if I could
 figure out the memory usage of httpd until I get my additional memory in
 the server as it's in order and I don't have it yet.

 But now, I have more process running then the kern.maxproc value and I
 can't even to pkill httpd for example as it gets

 sh: cannot fork - try again.

 kill is a shell builtin and doesn't need to fork.

Yes, I can use it, but I can't figure out the process ID. I am trying to
understand the man page on this to kill the group 67, or www.


you only need to kill apache.

read thepid  httpd.pid
kill $thepid



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Daniel Ouellet

Ted Unangst wrote:

read thepid  httpd.pid
kill $thepid


Thank you!!!

This work.

But what would be the proper syntax based on the man page to kill the 
group if possible?


Based on the man page it should be possible no?

In any case, this work, but I still would love to know how to do this 
for the group.


Thanks Ted! You did save me a trip!

Best,

Daniel



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Stuart Henderson
 kill is a shell builtin and doesn't need to fork.

useful one to remember, thanks tedu.

 Yes, I can use it, but I can't figure out the process ID. I am trying to 
 understand the man page on this to kill the group 67, or www.

there are other builtins, too:
$ for i in /var/run/*.pid;do read x  $i; echo $i $x; done

If you really need to find httpd's pid, you could sacrifice one of
your two shells to 'exec ps ax'. Although maybe 'exec reboot' is all
you really need.

 Man said

That's for /bin/kill rather than the shell builtin (though neither
manpage really helps with your present situation).



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Daniel Ouellet

Stuart Henderson wrote:

there are other builtins, too:
$ for i in /var/run/*.pid;do read x  $i; echo $i $x; done

If you really need to find httpd's pid, you could sacrifice one of


oh, of course.. /var/www/logs/httpd.pid


I did try the cat, and more witch both reply with cannot fork - try 
again. Didn't think or echo, may have worked, or may not. Not sure that 
it is built in sh, or ksh shell.


The read did the truck however.



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Joachim Schipper
On Tue, May 01, 2007 at 07:49:42PM -0400, Daniel Ouellet wrote:
 Ted Unangst wrote:
 read thepid  httpd.pid
 kill $thepid
 
 Thank you!!!
 
 This work.
 
 But what would be the proper syntax based on the man page to kill the 
 group if possible?
 
 Based on the man page it should be possible no?
 
 In any case, this work, but I still would love to know how to do this 
 for the group.

You could always try 'exec pkill httpd'. Of course, you lose your shell,
so you better make sure that that actually works...

Joachim

-- 
TFMotD: pkg_merge (1) - merge several packages into a fat package



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Daniel Ouellet

Stuart Henderson wrote:

kill is a shell builtin and doesn't need to fork.


useful one to remember, thanks tedu.


I kind of wish that pkill was too this time, but worked around it with 
Ted's help. All is good in the end and I learn something new today!


Yes, I can use it, but I can't figure out the process ID. I am trying to 
understand the man page on this to kill the group 67, or www.


there are other builtins, too:
$ for i in /var/run/*.pid;do read x  $i; echo $i $x; done


I guess that wouldn't have been of any help in case of ntpd, or bgpd 
right as they don't use pid. (; I know Henning doesn't like pid.



If you really need to find httpd's pid, you could sacrifice one of
your two shells to 'exec ps ax'. Although maybe 'exec reboot' is all
you really need.


Man said


That's for /bin/kill rather than the shell builtin (though neither
manpage really helps with your present situation).


So, there wasn't any way to kill a group via kill using the group ID 
itself then right?


Just trying to learn from my mistakes should that even happen again in 
the future. Hopefully never, but knowledge is always a good thing.


Many thanks.

Daniel



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Keith Richardson

Daniel Ouellet wrote:


Yes, I can use it, but I can't figure out the process ID. I am trying 
to understand the man page on this to kill the group 67, or www.


Obviously, I can't figure out the proper use of that syntax here.

Man said

The following PIDs have special meanings:
-1  If superuser, broadcast the signal to all processes; other-
wise, broadcast to all processes belonging to the user.
-pgid   Send the signal to all processes within the specified pro-
cess group.


You are confusing user group (i.e. www) with process group (i.e. logical 
grouping of processes for job contol, etc..). 

obsdev $ id -g 
1000

obsdev $ ps -o pid,gid,pgid,command
 PID   GID  PGID COMMAND
31803  1000 31803 -ksh (ksh)
21293  1000 21293 ps -o pid
31754  1000 26374 (netstat)
26374  1000 26374 /bin/sh /usr/local/bin/firefox
7853  1000 26374 /bin/sh /usr/local/mozilla-firefox/run-mozilla.sh 
/usr/local/mozilla-firefox/run-mozilla.sh

30367  1000 26374 /usr/local/mozilla-firefox/firefox-bin
30089  1000 26374 /usr/local/libexec/gconfd-2 12
1501  1000  1501 /bin/sh /usr/local/bin/thunderbird
14044  1000  1501 /bin/sh /usr/local/mozilla-thunderbird/run-mozilla.sh 
/usr/local/mozilla-thunderbird/run-mozilla.sh

29898  1000  1501 /usr/local/mozilla-thunderbird/thunderbird-bin
6987  1000  6987 -ksh (ksh)
1708  1000  1708 -ksh (ksh)
12309  1000 12309 -ksh (ksh)


See ps(1) and termios(4)

note: termios had the most descriptive explanation of process group 
under Job Control that I could find in a few minutes.  There probably is 
a better man page.


I do not know a way to find process group without forking.  An 
alternative (if you could not determine process ID) desperation move 
would be kill -1 as root (it should not kill system processes according 
to kill(2))



-Keith



Re: sysctl kern.maxproc help needed

2007-05-01 Thread Daniel Ouellet

Keith Richardson wrote:
You are confusing user group (i.e. www) with process group (i.e. logical 
grouping of processes for job contol, etc..).


Obviously I did.


See ps(1) and termios(4)

note: termios had the most descriptive explanation of process group 
under Job Control that I could find in a few minutes.  There probably is 
a better man page.


I do not know a way to find process group without forking.  An 
alternative (if you could not determine process ID) desperation move 
would be kill -1 as root (it should not kill system processes according 
to kill(2))


Thanks for the pointers!

Daniel