Rex::C...rocess(3pm)

πŸ’– NAME πŸ’–

Rex::Commands::Process β€” literally the process management commands module, bestie. It lives in the Rex::C...rocess(3pm) page of the User Contributed Perl Documentation, and it's here to help you wrangle processes like the main character you are. πŸ‘‘


✨ DESCRIPTION ✨

okay so. With this module you can manage processes. List them, kill them, and so on. That's the whole vibe. πŸ¦‹

A couple of things you need to know though, no cap:

  • Version <= 1.0: all these functions will not be reported. πŸ’€
  • All these functions are not idempotent. So like… running them twice is not the same as running them once. Don't @ me, that's just the facts. 🫢

🌸 SYNOPSIS 🌸

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

that's the whole teaser. iconic. πŸ’…


πŸŽ€ EXPORTED FUNCTIONS πŸŽ€

πŸ’… kill($pid, $sig)

Will kill the given process id. If $sig is specified it will kill with the given signal. πŸ”₯

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 the given signal. (Yes bestie, it's the same energy as kill, just by name instead of pid.) πŸ’€

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. The way that it just hands you everything?? obsessed. 🌈

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

On most operating systems it is also possible to define custom parameters for ps() function. Slay. ✨

task "ps", "server01", sub {
  my @list = grep { $_->{"ni"} == -5 } ps("command","ni");
};

This example would contain all processes with a nice of -5. lowkey a flex, highkey useful. 🧚

πŸ’œ nice($pid, $level)

Renice a process identified by $pid with the priority $level. Yes queen, adjust that niceness. πŸŽ€

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

⭐ quick vibe check, bestie: these are not idempotent, so please don't loop them like they're free. πŸ™ˆ

and that's the page!! πŸ’– this was Rex::C...rocess(3pm) from the User Contributed Perl Documentation, generated with perl v5.40.1 on 2025-10-03. go manage some processes, you absolute icon. 🌸🫢

πŸ“¦ where this page comes from