Rex::Co...Process(3)
π Rex::Commands::Process β the glow-up
okay bestie, so this is the Rex::Co...Process(3) page (the actual module is Rex::Commands::Process, she's just going by a nickname in the header for β¨space reasonsβ¨). User contributed perl documentation, we love to see it. Let's get into it π«Ά
β¨ NAME β¨
Rex::Commands::Process β process management commands. that's it, that's the whole vibe. π
π¦ DESCRIPTION π¦
So with this module you can manage processes. Listing them, killing them, and so on. full main character energy for your process table honestly π
heads up bestie: Version <= 1.0: All these functions will not be reported. and like, also β all these functions are not idempotent. not me repeating that three times in my head. no cap, do not assume running them twice gives you the same result. it does not. π
π SYNOPSIS π
the little trailer, the vibe preview:
kill $pid;
killall "apache2";
nice($pid, $level);
πΈ EXPORTED FUNCTIONS πΈ
here come the actual functions, alphabet-ish order, buckle in π§
π kill($pid, $sig)
Will kill the given process id. and if $sig is specified, it will kill with the given signal. that's the whole deal. periodt. β
task "kill", "server01", sub {
kill 9931;
kill 9931, -9;
};
first one = polite little default kill. second one = -9, aka the "we're not asking anymore" signal. ππ₯
π killall($name, $sig)
Will kill the given process. If $sig is specified it will kill with the given signal. same energy as above but you're naming the process instead of the pid, iykyk π
task "kill-apaches", "server01", sub {
killall "apache2";
killall "apache2", -9;
};
π ps
List all processes on a system. and it will return all fields of a ps aux β every single one, she's generous π
task "ps", "server01", sub {
for my $process (ps()) {
say "command > " . $process->{"command"};
say "pid > " . $process->{"pid"};
say "cpu-usage> " . $process->{"cpu"};
}
};
and on most operating systems it is also possible to define custom parameters for ps() function. custom fields?? we stan a configurable queen β¨
task "ps", "server01", sub {
my @list = grep { $_->{"ni"} == -5 } ps("command","ni");
};
This example would contain all processes with a nice of -5. (yes, exactly -5, keep the minus, it's load-bearing π)
π§ nice($pid, $level)
Renice a process identified by $pid with the priority $level. it's giving "please calm down, bestie" but in scheduler terms π
task "renice", "server01", sub {
nice (153, -5);
};
friendly reminder: go back and re-read that DESCRIPTION bit β these functions are not idempotent, so don't go running them in a loop thinking it's a no-op. it is very much an op. π
π«Ά and that's the page!
alright bestie, that's the whole thing. this page came to you from perl v5.42.3 and it's dated 2023-08-05 β so if you're reading this in the future, yes she's still serving, mwah π bye! π
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms