Till Westmann | ea8ab39 | 2013-06-05 15:17:08 -0700 | [diff] [blame] | 1 | #/* |
| 2 | # Copyright 2009-2013 by The Regents of the University of California |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # you may obtain a copy of the License from |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | #*/ |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 15 | USERNAME=$1 |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 16 | if [ ! -d $MANAGIX_HOME/logs ]; |
| 17 | then |
| 18 | mkdir -p $MANAGIX_HOME/logs |
| 19 | fi |
| 20 | LOGDIR=$MANAGIX_HOME/logs |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 21 | if [ $DAEMON == "false" ]; then |
| 22 | if [ -z $USERNAME ] |
| 23 | then |
| 24 | 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] | 25 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 26 | echo "$cmd_output" |
| 27 | else |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 28 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 29 | cmd_output=$(ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null) |
| 30 | echo "$cmd_output" |
| 31 | fi |
| 32 | else |
| 33 | if [ -z $USERNAME ]; |
| 34 | then |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 35 | echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 36 | ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 37 | else |
ramangrover29@gmail.com | 3bfd1b5 | 2013-03-08 18:56:42 +0000 | [diff] [blame] | 38 | echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 39 | ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" & |
| 40 | fi |
| 41 | fi |