ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 1 | USERNAME=$1 |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 2 | if [ ! -d $MANAGIX_HOME/logs ]; |
| 3 | then |
| 4 | mkdir -p $MANAGIX_HOME/logs |
| 5 | fi |
| 6 | LOGDIR=$MANAGIX_HOME/logs |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 7 | if [ $DAEMON == "false" ]; then |
| 8 | if [ -z $USERNAME ] |
| 9 | then |
| 10 | cmd_output=$(ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null) |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 11 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 12 | echo "$cmd_output" |
| 13 | else |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 14 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 15 | cmd_output=$(ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null) |
| 16 | echo "$cmd_output" |
| 17 | fi |
| 18 | else |
| 19 | if [ -z $USERNAME ]; |
| 20 | then |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 21 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 22 | ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 23 | else |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 24 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 25 | ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 26 | fi |
| 27 | fi |