V6evalRemote(3)

NAME
V6evalRemote - Perl interface to control NUT via serial line.

SYNOPSIS

DESCRIPTION

INTERFACE OF REMOTE CONTROL SCRIPT
                              <Default>      <Descriptions>
                              -----------    -----------------------
  -t<target_type>             kame-freebsd   kame-freebsd
                                             hitachi-nr60
                                             nec-libra
                                             nec-libra-utcpip
                                             yamaha-ws-one
  -T<cu_command_path>         cu             cu command path
  -d<serial_device_name>      cuaa0c         see cu(1)
  -u<user_name>               root           user name
  -p<password>                v6eval         user password
  -U<login_prompt>            'ogin: '       Regular-expression
  -P<password_prompt>         'assword:'     Reqular-expression
  -C<command_prompt>          '(#|\$|%|>) '  Reqular-expression
  -v<debug level>             0              $Expect::Debug
  -i<internal debug level>    0              $Expect::Exp_Internal
  -o<stdout>                  0              $Expect::Log_Stdout
  -V                          N/A            enable other debug messages
  -s<interval>                0              send speed (sec.)
  -l{0,1}                     0              enable rLogout()
  -h                          N/A            show this message

SUPPORTED FUNCTION

rOpen
  Open the remote control program.

  sub rOpen()

  RETURN VALUES
  undef: error
  Otherwise: Expect handle

rLogin
  Log into the target machine.

  sub rLogin($) { my (
      $timeout          # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rCommand
  Execute a command.

  sub rCommand($$) { my (
      $command  # command
      $timeout  # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  ==1: success: command exit status is 0
  ==2: warning: command exit status isn't 0
  ==3: warning: command exit status unknown

rReboot
  Reboot the target machine.
  The functin return when getting login prompt.

  sub rReboot($) { my (
      $timeout          # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rRebootAsync
  Reboot the target machine.
  The function return immediately when executing reboot command.

  sub rRebootAsync($) { my (
      $timeout          # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rPutfile
  Copy a local file to a remote file.

  sub rPutfile($$$) { my (
      $from,
      $to,
      $timeout,
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rLogout
  Log out of the target machine.

  sub rLogout($) { my (
      $timeout          # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rClose
  Terminate the remote control program.

  sub rClose($) { my (
      $timeout          # timeout sec.
  )=@_;

  RETURN VALUES
  ==0: error
  !=0: success

rType
  Set/get a target machine type.

  sub rType(;$)

  RETURN VALUES
  Returns a target machine type.

rDevice
  Set/get serial device name.

  sub rDevice(;$)

  RETURN VALUES
  Returns serial device name.

rUser
  Set/get user name.

  sub rUser(;$)

  RETURN VALUES
  Returns user name.

rUserPrompt
  Set/get user prompt.

  sub rUserPrompt(;$)

  RETURN VALUES
  Returns user prompt.

rPasswordPrompt
  Set/get password prompt.

  sub rPasswordPrompt(;$)

  RETURN VALUES
  Returns password prompt.

rCommandPrompt
  Set/get command prompt.

  sub rCommandPrompt(;$)

  RETURN VALUES
  Returns command prompt.

rDebug
  Set/get Expect.pm's debug()

  sub rDebug(;$)

  RETURN VALUES
  Returns $Remote->debug().

rExpInternal
  Set/get Expect.pm's exp_internal()

  sub rExpInternal(;$)

  RETURN VALUES
  Returns $Remote->exp_internal()

rLogStdout
  Set/get Expect.pm's log_stdout()

  sub rLogStdout(;$)

  RETURN VALUES
  Returns $Remote->log_stdout()

rRemoteSpeed
  Set/get interval that characters are sent at.

  sub rRemoteSpeed(;$)

  RETURN VALUES
  Returns interval value.

rEnableLogout
  Enable(!=0)/Desable(==0, default) rLogout()

  sub rEnableLogout(;$)

  RETURN VALUES
  Returns previous value

EXAMPLE
  #!/usr/bin/perl

  use V6evalRemote;

  print "Open remote\n";
  rOpen() || exit $V6evalRemote::exitFail;
  $type=rType();

  $rOpt_timeout=5 if (!defined $rOpt_timeout);

  if($type eq "kame-freebsd") {
      print "Login\n";
      rLogin($rOpt_timeout) || exit $V6evalRemote::exitFail;
      print "List dir\n";
      rCommand("ls -a", $rOpt_timeout) || exit $V6evalRemote::exitFail;
      print "Logout\n";
      rLogout($rOpt_timeout) || exit $V6evalRemote::exitFail;
  } else {
    print "List dir of NUT($type) manually, ".
        "then press enter key.\n";
    <STDIN>;
  }
  print "Close remote\n";
  rClose();
  exit $V6evalRemote::exitPass;

REQUIRED PACKAGES
  Expect.pm
  Stty.pm
  Pty.pm