Rex::C...:Sysctl(3pm)
π Rex::Commands::Sysctl π
okay bestie, gather round, it's a Perl module moment β¨ β this is Rex::Commands::Sysctl, part of the User Contributed Perl Documentation (that's the 3pm corner of the manual-verse, iykyk), and it is literally here to let you play with sysctl. π
πΈ NAME πΈ
Rex::Commands::Sysctl β Manipulate sysctl π¦
β¨ DESCRIPTION β¨
So like, with this module you can set and get sysctl parameters. That's the whole vibe. π
Little heads-up, bestie: Version <= 1.0: all these functions will not be reported. π
And also β super important, no cap β all these functions are not idempotent. So don't come for me when they do the thing multiple times, because that's just who they are. π
π SYNOPSIS π
use Rex::Commands::Sysctl;
my $data = sysctl "net.ipv4.tcp_keepalive_time";
sysctl "net.ipv4.tcp_keepalive_time" => 1800;
look at her go π«Ά
π EXPORTED FUNCTIONS π
π sysctl($key [, $val [, %options]])
This function will read the sysctl key $key. Easy. Slay. β
If $val is given, then this function will set the sysctl key $key. Now we're cooking. π₯
task "tune", "server01", sub {
if( sysctl("net.ipv4.ip_forward") == 0 ) {
sysctl "net.ipv4.ip_forward" => 1;
}
};
If both $val and the ensure option are used, the sysctl key is modified and the value may persist in /etc/sysctl.conf β depending on whether the ensure option is "present" or "absent". πβ¨
With ensure => "present", if the key already exists in the file, it will be updated to the new value. π
task "forwarding", "server01", sub {
sysctl "net.ipv4.ip_forward" => 1, ensure => "present";
}
fr fr, remember: these functions are not idempotent, and on Version <= 1.0 they will not be reported. Not me warning you twice β okay maybe it's me. π
and that's the whole page, bestie π§π this was perl v5.40.1 dated 2025-10-03 β periodt. go forth and tune those kernels, main character energy only. π
πΈ
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms