The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rex::Commands::Run - Execute a remote command

DESCRIPTION

With this module you can run a command.

SYNOPSIS

 my $output = run "ls -l";
 sudo "id";

EXPORTED FUNCTIONS

run($command)

This function will execute the given command and returns the output.

 task "uptime", "server01", sub {
    say run "uptime";
 };
can_run($command)

This function checks if a command is in the path or is available.

 task "uptime", sub {
    if(can_run "uptime") {
       say run "uptime";
    }
 };
sudo($command)

Run $command with sudo. Define the password for sudo with sudo_password.

 task "eth1-down", sub {
   sudo "ifconfig eth1 down";
 };