blob: d9ad7b2f7aaa330d6d8adb7add9475f0e701230f [file] [log] [blame]
Ian Maxond8071ee2015-06-24 17:39:05 -07001#!/usr/bin/env bash
Ian Maxon305858c2015-10-01 19:00:14 -07002# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
Ian Maxond8071ee2015-06-24 17:39:05 -070018
ramangrover29bfe46232013-05-30 23:16:32 -070019USERNAME=$1
20if [ ! -d $MANAGIX_HOME/logs ];
21then
22 mkdir -p $MANAGIX_HOME/logs
23fi
24LOGDIR=$MANAGIX_HOME/logs
25if [ $DAEMON == "false" ]; then
26 if [ -z $USERNAME ]
27 then
28 cmd_output=$(ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null)
29 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
30 echo "$cmd_output"
31 else
32 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS" >> $LOGDIR/execute.log
33 cmd_output=$(ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" 2>&1 >/dev/null)
34 echo "$cmd_output"
35 fi
36else
37 if [ -z $USERNAME ];
38 then
39 echo "ssh $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
40 ssh $IP_LOCATION "$ENV $SCRIPT $ARGS" &
41 else
42 echo "ssh -l $USERNAME $IP_LOCATION $ENV $SCRIPT $ARGS &" >> $LOGDIR/execute.log
43 ssh -l $USERNAME $IP_LOCATION "$ENV $SCRIPT $ARGS" &
44 fi
45fi