Class: OpenHAB::Core::Actions::Exec

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/actions/exec.rb

Overview

See Also:

Class Method Summary collapse

Class Method Details

.execute_command_line(command_line) ⇒ void .execute_command_line(timeout, command_line) ⇒ String

This method returns an undefined value.

Overloads:

  • .execute_command_line(command_line) ⇒ void

    This method returns an undefined value.

    Executes a command on the command line without waiting for the command to complete.

    Examples:

    Execute an external command

    rule 'Run a command' do
      every :day
      run do
        Exec.execute_command_line('/bin/true')
      end
    end

    Parameters:

    • command_line (String)
  • .execute_command_line(timeout, command_line) ⇒ String

    Executes a command on the command and waits timeout seconds for the command to complete, returning the output from the command as a String.

    Examples:

    Execute an external command and process its results

    rule 'Run a command' do
      every :day
      run do
        TodaysHoliday_String.update(Exec.execute_command_line(5.seconds, '/home/cody/determine_holiday.rb')
      end
    end

    Parameters:

    • timeout (Duration)
    • command_line (String)

    Returns:

    • (String)


# File 'lib/openhab/core/actions/exec.rb', line 10