Rex::Commands::Run - Execute a remote command
With this module you can run a command.
my $output = run "ls -l"; sudo "id";
This function will execute the given command and returns the output.
task "uptime", "server01", sub { say run "uptime"; };
This function checks if a command is in the path or is available.
task "uptime", sub { if(can_run "uptime") { say run "uptime"; } };
Run $command with sudo. Define the password for sudo with sudo_password.
task "eth1-down", sub { sudo "ifconfig eth1 down"; };
To install Rex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex
CPAN shell
perl -MCPAN -e shell install Rex
For more information on module installation, please visit the detailed CPAN module installation guide.