blob: 30f6c2f5fc7c9352c3f48ee90471a1d6c400a072 [file] [log] [blame]
ramangrover29116eb972013-02-20 20:47:35 +00001USERNAME=$1
ramangrover29@gmail.com3bfd1b52013-03-08 18:56:42 +00002if [ ! -d $MANAGIX_HOME/logs ];
3then
4 mkdir -p $MANAGIX_HOME/logs
5fi
6LOGDIR=$MANAGIX_HOME/logs
ramangrover29116eb972013-02-20 20:47:35 +00007if [ $DAEMON == "false" ]; then
8 if [ -z $USERNAME ]
9 then
10 cmd_output=$(ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null)
ramangrover29@gmail.com3bfd1b52013-03-08 18:56:42 +000011 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
ramangrover29116eb972013-02-20 20:47:35 +000012 echo "$cmd_output"
13 else
ramangrover29@gmail.com3bfd1b52013-03-08 18:56:42 +000014 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
ramangrover29116eb972013-02-20 20:47:35 +000015 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
ramangrover29@gmail.com3bfd1b52013-03-08 18:56:42 +000021 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
ramangrover29116eb972013-02-20 20:47:35 +000022 ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" &
23 else
ramangrover29@gmail.com3bfd1b52013-03-08 18:56:42 +000024 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
ramangrover29116eb972013-02-20 20:47:35 +000025 ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" &
26 fi
27fi