Search plugin: Or browse by category:
bash summary
Plugin Name: bash
Version: 0.1.4
Author: @melezhik
Realease Date: 2017-01-02 09:50:50
Short Description: Execute bash commands
Category: sparrowdo
Plugin web page: https://github.com/melezhik/bash.git
Download link: bash-v0.001004.tar.gz
Latest version link: https://sparrowhub.org/info/bash
bash documentation
bash doc

SYNOPSIS

Execute bash commands

INSTALL

$ sparrow plg install bash

USAGE

Manually

$ sparrow plg run bash --param user=foo --param command="'echo hello world'"

With sparrowdo

$ cat sparrowfile


task_run %(
  task    => "server uptime",
  plugin  => "bash",
  parameters => %(
    user      => 'root',
    command   => 'uptime',
    debug     => 1,
  )
);

Parameters

user

A user to execute a command. No default value. Optional.

command

A command to be executed. No default value. Obligatory.

expect_stdout

This is optional parameter. Verify if command print something into stdout. This should be Perl5 regex string.

Example:

$ sparrow plg run --param command="echo I AM OK" --param expect_stdout='I AM \S+'

Or via sparrowdo:

task_run %(
  task    => "server uptime",
  plugin  => "bash",
  parameters => %(
    command   => 'uptime',
    debug     => 0,
    expect_stdout => '\d\d:\d\d:\d\d'
  )
);

debug

Set bash debug mode on. Default value is 0 ( do not set ).

passing environment variables

Use envvars parameter. For example:

task_run %(
  task    => "GET http resource",
  plugin  => "bash",
  parameters => %(
    command   => 'curl https://sparrowhub.org',
    envvars   => %(
      http_proxy  => input_params('HttpProxy'),
      https_proxy => input_params('HttpsProxy'),
    )
  )
);

Author

Alexey Melezhik