Rex::Co...::Sysctl(3)
π NAME π
okay so bestie, welcome to the Rex::Co...::Sysctl(3) page from the User Contributed Perl Documentation. the star of the show is Rex::Commands::Sysctl - Manipulate sysctl. it's giving sysctl management, and it's lowkey iconic. π
π¦ DESCRIPTION π¦
With this module you can set and get sysctl parameters. no cap.
Version <= 1.0: All these functions will not be reported.
π¨ heads up, bestie: All these functions are not idempotent. so yeah, the docs are saying the quiet part loud β don't expect these to be neat little repeat-safe operations. π
β¨ SYNOPSIS β¨
use Rex::Commands::Sysctl;
my $data = sysctl "net.ipv4.tcp_keepalive_time";
sysctl "net.ipv4.tcp_keepalive_time" => 1800;
πΈ EXPORTED FUNCTIONS πΈ
π
sysctl($key [, $val [, %options]]) π
This function will read the sysctl key $key.
If $val is given, then this function will set the sysctl key $key.
task "tune", "server01", sub {
if( sysctl("net.ipv4.ip_forward") == 0 ) {
sysctl "net.ipv4.ip_forward" => 1;
}
};
If both $val and ensure option are used, the sysctl key is modified and the value may persist in /etc/sysctl.conf depending if 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";
}
okay that's the whole page, bestie π«Ά β brought to you by perl v5.42.3, dated 2023-08-05, and signed Rex::Co...::Sysctl(3). mwah π
π¦ 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