The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rex::Commands::Process - Process management commands

DESCRIPTION

With this module you can manage processes. List, Kill, and so on.

SYNOPSIS

 kill $pid;
 killall "apache2";
 nice($pid, $level);

EXPORTED FUNCTIONS

kill($pid, $sig)

Will kill the given process id. If $sig is specified it will kill with this.

 task "kill", "server01", sub {
    kill 9931;
    kill 9931, -9;
 };
killall($name, $sig)

Will kill the given process. If $sig is specified it will kill with this.

 task "kill-apaches", "server01", sub {
    killall "apache2";
    killall "apache2", -9;
 };
ps

List all processes on a system. Will return all fields of a ps aux.

 task "ps", "server01", sub {
    for my $process (ps()) {
      say "command  > " . $process->{"command"};
      say "pid      > " . $process->{"pid"};
      say "cpu-usage> " . $process->{"cpu"};
    }
 };
nice($pid, $level)

Renice a process identified by $pid with the priority $level.

 task "renice", "server01", sub {
    renice (153, -5);
 };