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