logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Rex::Commands::Sysctl - Manipulate sysctl

Description

       With this module you can set and get sysctl parameters.

       Version <= 1.0: All these functions will not be reported.

       All these functions are not idempotent.

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";
        }

perl v5.40.0                                       2025-02-06                         Rex::Commands::Sysctl(3pm)

Name

       Rex::Commands::Sysctl - Manipulate sysctl

Synopsis

        use Rex::Commands::Sysctl;

        my $data = sysctl "net.ipv4.tcp_keepalive_time";
        sysctl "net.ipv4.tcp_keepalive_time" => 1800;

See Also