exec method

void exec({
  1. required String host,
  2. required String command,
  3. bool agent = true,
  4. bool sudo = false,
  5. String? password,
  6. Progress? progress,
})

EXPERIMENTAL

executes command on a remote host over an ssh tunnel host is the remote host to execute the command on. If sudo is true then the command will be run with sudo. If you specify sudo as true then you MAY also pass in the sudo password for your account on the remote host. password is the current user's password on the remote host. The user's account on the remote host must be in the sudoers file. The command to execute on the remote host. The optional progress allows you to control how the output of the command is printed to the console. By default all output is supressed.

 // run mkdir on the remote host using sudo
 Remote.exec(
    host: fqdn,
    command: "mkdir -p /tmp/etc/openvpn",
    sudo: true,
    password: password,
    progress: Progress.print());

EXPERIMENTAL

Implementation

void exec({
  required String host,
  required String command,
  bool agent = true,
  bool sudo = false,
  String? password,
  Progress? progress,
}) {
  execList(
    host: host,
    commands: [command],
    agent: agent,
    sudo: sudo,
    password: password,
    progress: progress,
  );
}