Bug#583960: [v-admins] Bug#583960: Bug#583960: reniced: Add option to use `ps H -eo lwp, cmd` instead of `ps H -eo lwp, comm`

2010-07-04 Thread Debian bug at v.nix.is
On Wed, Jun 30, 2010 at 20:15, Christian Garbs mi...@cgarbs.de wrote:
 On Mon, Jun 07, 2010 at 08:56:43PM +, Debian bug at v.nix.is wrote:

 I looked at the source code for the 1.18 tarball and it doesn't work
 as expected because you're using the --user option to ps:

     $ ps H -o lwp,cmd --user 0|wc -l
     110
     $ ps H -o lwp,cmd --user 1001|wc -l
     22

 The command I used omitted that and used the -e option:

     $ ps H -eo lwp,cmd|wc -l
     231

 That allows me to filter all processes, including non-root
 processes.

 The --user option is only added when you're not root, otherweise -e is
 used:

    if ($root) {
        $cmdline .=  H -eo lwp,$psformat;
    } else {
        $cmdline .=  H -o lwp,$psformat --user $;
    }

 I think that's ok because AFAIK non-root users are not allowed to
 change the priority of other users' processes.  Only root can change
 those.

Ah, that should work then.

 It would be better to be able to control the entire ps command, not
 just the $psformat. That'd vven allow for the ability to use a
 non-ps(1) program to get the process list.

 I'd like to keep the distinction between root and non-root usage
 because that way it works 'out of the box' - as root, you can change
 everything and als a normal user only your processes are affected.

 Because of this changing the ps(1) command would mean not only one,
 but two new configuration variables - one for the root-ps(1) command
 and one for the non-root-ps(1) command.  Until anybody really needs a
 non-ps(1) command, I'd like to keep reniced as simple and short as
 possible.


 To sum it up:

  * ps -e should be chosen automatically when you are root
  * changing other users' processes as non-root should throw errors
  * for now I'd like to stick with ps(1)

 Could you please confirm the first two?

cgarbs.de's httpd was returning connection refused when this is
written. So I couldn't test your new version. But the above looks
good, and does what I want.

I just wanted to point out that if the ps format was completely
customizable it might be easier for people who like a ps invocation
that doesn't start with ps H -eo lwp, to use the program,
e.g. someone that wants to write regexes against ps auxf.

But that's at your discretion, this works for me and solves the bug,
thanks.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#583960: [v-admins] Bug#583960: Bug#583960: reniced: Add option to use `ps H -eo lwp, cmd` instead of `ps H -eo lwp, comm`

2010-07-04 Thread Christian Garbs
On Sun, Jul 04, 2010 at 01:47:30PM +, Debian bug at v.nix.is wrote:
 On Wed, Jun 30, 2010 at 20:15, Christian Garbs mi...@cgarbs.de wrote:

  To sum it up:
 
   * ps -e should be chosen automatically when you are root
   * changing other users' processes as non-root should throw errors
   * for now I'd like to stick with ps(1)
 
  Could you please confirm the first two?
 
 cgarbs.de's httpd was returning connection refused when this is
 written. So I couldn't test your new version. But the above looks
 good, and does what I want.

Unfortunately, I'm currently having some hosting related trouble...

 I just wanted to point out that if the ps format was completely
 customizable it might be easier for people who like a ps invocation
 that doesn't start with ps H -eo lwp, to use the program,
 e.g. someone that wants to write regexes against ps auxf.

ps auxf would not work, the -o lwp, is needed because the script
needs to know the PID of the target process, so it has to be the first
column in the output.  When the PID is missing (or moved to some other
column) I'm running into parsing trouble.
 
 But that's at your discretion, this works for me and solves the bug,
 thanks.

Great, then I'll close this bug with the next release which will
happen when my server is online again.  The next reniced version will
also include an option to control OOM killer behaviour via
/proc/$PID/oom_adj

Regards
Christian
-- 
Christian.Garbs.http://www.cgarbs.de

Schlimmer sind die, welche ALLES GROSS SCHREIBEN. Und da gibt's sogar 
PROFESSOREN. Ich musste neulich ein GROSS GESCHRIEBENES SKRIPT über 
Areosolteilchen lesen, au weia!(Stefan Heimers in dcoul.misc)


signature.asc
Description: Digital signature