blob: 30f6c2f5fc7c9352c3f48ee90471a1d6c400a072 [file] [log] [blame]
ramangrover29bfe46232013-05-30 23:16:32 -07001USERNAME=$1
2if [ ! -d $MANAGIX_HOME/logs ];
3then
4 mkdir -p $MANAGIX_HOME/logs
5fi
6LOGDIR=$MANAGIX_HOME/logs
7if [ $DAEMON == "false" ]; then
8 if [ -z $USERNAME ]
9 then
10 cmd_output=$(ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null)
11 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
12 echo "$cmd_output"
13 else
14 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
15 cmd_output=$(ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null)
16 echo "$cmd_output"
17 fi
18else
19 if [ -z $USERNAME ];
20 then
21 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
22 ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" &
23 else
24 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
25 ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" &
26 fi
27fi