App-RemoteCommand

 view release on metacpan or  search on metacpan

lib/App/RemoteCommand/Tutorial.pod  view on Meta::CPAN

    SUCCESS www001.example.jp
    SUCCESS www002.example.jp

=item 2. execute local script

Sometimes it is hard to write command in one liner.
Why don't you write a script in local and execute it with C< rcommand >:

    > cat local-script.sh
    #!/bin/bash
    percent=`df -h | grep /dev/sda1 | perl -anle '$F[-2] =~ s/%//; print $F[-2]'`
    if [ $percent -lt 80 ]; then
      echo "OK $percent%"
    else
      echo "NG $percent%"; exit 1
    fi

    > rcommand --script local-script.sh 'www00[1-2].example.jp'
    [www002.example.jp] OK 65%
    [www001.example.jp] NG 85%
    FAIL www001.example.jp
    SUCCESS www002.example.jp

Note that the SUCCESS/FAIL summary is displayed in the end.



( run in 0.369 second using v1.01-cache-2.11-cpan-05162d3a2b1 )