Ian Maxon | d8071ee | 2015-06-24 17:39:05 -0700 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | |
ramangrover29 | bfe4623 | 2013-05-30 23:16:32 -0700 | [diff] [blame] | 3 | USERNAME=$1 |
| 4 | if [ ! -d $MANAGIX_HOME/logs ]; |
| 5 | then |
| 6 | mkdir -p $MANAGIX_HOME/logs |
| 7 | fi |
| 8 | LOGDIR=$MANAGIX_HOME/logs |
| 9 | if [ $DAEMON == "false" ]; then |
| 10 | if [ -z $USERNAME ] |
| 11 | then |
| 12 | cmd_output=$(ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null) |
| 13 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
| 14 | echo "$cmd_output" |
| 15 | else |
| 16 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
| 17 | cmd_output=$(ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null) |
| 18 | echo "$cmd_output" |
| 19 | fi |
| 20 | else |
| 21 | if [ -z $USERNAME ]; |
| 22 | then |
| 23 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
| 24 | ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 25 | else |
| 26 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
| 27 | ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 28 | fi |
| 29 | fi |