Run remote commands

Posted by on Nov 24, 2012 in Tivoli | No Comments

The following script will run remote commands on an Endpoint via the wadminep functionality and then output the results to the screen.

#!/usr/bin/sh

# Runs a command against an endpoint using wadminep functionality
# usage: exec_cmd.sh [EP] [command]

EP=$1
shift
TEMP=exec_cmd.$$
ERR=exec_cmd_err.$$

wadminep $EP exec_process sh -c "$* > $TEMP 2> $ERR" | tail +2l
echo "***** STDOUT *****"
wadminep $EP view_file $TEMP | tail +2
echo "***** STDERR *****"
wadminep $EP view_file $ERR | tail +2
echo "******************"
wadminep $EP remove_file $TEMP >/dev/null
wadminep $EP remove_file $ERR >/dev/null

Leave a Reply