blob: 3534c63316f08cf9a5be4270648ce1c5cfb4693b [file] [log] [blame]
Ian Maxond8071ee2015-06-24 17:39:05 -07001#!/usr/bin/env bash
2
ramangrover29bfe46232013-05-30 23:16:32 -07003USERNAME=$1
4if [ ! -d $MANAGIX_HOME/logs ];
5then
6 mkdir -p $MANAGIX_HOME/logs
7fi
8LOGDIR=$MANAGIX_HOME/logs
9if [ $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
20else
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
29fi