Make managix scripts properly executable
Most of the scripts managix was using were missing the shebang at the beginning of the script.
This can be problematic if one uses a shell besides bash. This patch fixes that.
Change-Id: Ie7722f832d0d25bec049e123a0ed1570d0aeb650
Reviewed-on: https://asterix-gerrit.ics.uci.edu/286
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Raman Grover <ramangrover29@gmail.com>
diff --git a/asterix-events/src/main/resources/events/backup/backup.sh b/asterix-events/src/main/resources/events/backup/backup.sh
index ec28b59..350e795 100644
--- a/asterix-events/src/main/resources/events/backup/backup.sh
+++ b/asterix-events/src/main/resources/events/backup/backup.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
+
WORKING_DIR=$1
ASTERIX_INSTANCE_NAME=$2
ASTERIX_IODEVICES=$3
diff --git a/asterix-events/src/main/resources/events/cc_failure/cc_failure.sh b/asterix-events/src/main/resources/events/cc_failure/cc_failure.sh
index 2b98b60..cd04071 100644
--- a/asterix-events/src/main/resources/events/cc_failure/cc_failure.sh
+++ b/asterix-events/src/main/resources/events/cc_failure/cc_failure.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
-#kill -9 `ps -ef | grep hyracks | grep -v grep | cut -d "/" -f1 | tr -s " " | cut -d " " -f2`
+
CC_PARENT_ID_INFO=`ps -ef | grep asterix | grep cc_start | grep -v ssh`
CC_PARENT_ID=`echo $CC_PARENT_ID_INFO | tr -s " " | cut -d " " -f2`
CC_ID_INFO=`ps -ef | grep asterix | grep $CC_PARENT_ID | grep -v bash`
diff --git a/asterix-events/src/main/resources/events/cc_start/cc_start.sh b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
index 068c152..a5fb853 100644
--- a/asterix-events/src/main/resources/events/cc_start/cc_start.sh
+++ b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
-if [ ! -d $LOG_DIR ];
+
+if [ ! -d $LOG_DIR ];
then
mkdir -p $LOG_DIR
fi
diff --git a/asterix-events/src/main/resources/events/execute.sh b/asterix-events/src/main/resources/events/execute.sh
index 30f6c2f..3534c63 100644
--- a/asterix-events/src/main/resources/events/execute.sh
+++ b/asterix-events/src/main/resources/events/execute.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
USERNAME=$1
if [ ! -d $MANAGIX_HOME/logs ];
then
diff --git a/asterix-events/src/main/resources/events/file/create_file.sh b/asterix-events/src/main/resources/events/file/create_file.sh
index 762a2d3..dbec6b4 100644
--- a/asterix-events/src/main/resources/events/file/create_file.sh
+++ b/asterix-events/src/main/resources/events/file/create_file.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
mkdir -p $1
echo "touch $1/$2" >> ~/file_create.log
touch $1/$2
diff --git a/asterix-events/src/main/resources/events/file/delete.sh b/asterix-events/src/main/resources/events/file/delete.sh
index a6673e2..c9399f9 100644
--- a/asterix-events/src/main/resources/events/file/delete.sh
+++ b/asterix-events/src/main/resources/events/file/delete.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
PATH_TO_DELETE=$1
echo "rm -rf $PATH_TO_DELETE" >> ~/backup.log
rm -rf $PATH_TO_DELETE
diff --git a/asterix-events/src/main/resources/events/file/dir_copy.sh b/asterix-events/src/main/resources/events/file/dir_copy.sh
index bac2f32..8273c6a 100755
--- a/asterix-events/src/main/resources/events/file/dir_copy.sh
+++ b/asterix-events/src/main/resources/events/file/dir_copy.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
USERNAME=$1
SRC_HOST=$2
SRC_DIR=$3
diff --git a/asterix-events/src/main/resources/events/file/dir_transfer.sh b/asterix-events/src/main/resources/events/file/dir_transfer.sh
index 6818149..6fbbcee 100644
--- a/asterix-events/src/main/resources/events/file/dir_transfer.sh
+++ b/asterix-events/src/main/resources/events/file/dir_transfer.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
USERNAME=$1
DIR_TO_TRANSFER=$2
DEST_HOST=$3
diff --git a/asterix-events/src/main/resources/events/file/transfer.sh b/asterix-events/src/main/resources/events/file/transfer.sh
index 8b5dfa3..b7dd5f7 100644
--- a/asterix-events/src/main/resources/events/file/transfer.sh
+++ b/asterix-events/src/main/resources/events/file/transfer.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
+
USERNAME=$1
FILE_TO_TRANSFER=$2
DEST_HOST=$3
diff --git a/asterix-events/src/main/resources/events/hdfs/delete.sh b/asterix-events/src/main/resources/events/hdfs/delete.sh
index 27af4d1..19a7196 100644
--- a/asterix-events/src/main/resources/events/hdfs/delete.sh
+++ b/asterix-events/src/main/resources/events/hdfs/delete.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
WORKING_DIR=$1
HADOOP_VERSION=$2
HDFS_URL=$3
diff --git a/asterix-events/src/main/resources/events/node_failure/nc_failure.sh b/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
index 727d09c..08e3f17 100644
--- a/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
+++ b/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
NC_ID=$1
INFO=`ps -ef | grep nc_join | grep -v grep | grep -v ssh| grep $NC_ID | head -n 1`
diff --git a/asterix-events/src/main/resources/events/node_info/node_info.sh b/asterix-events/src/main/resources/events/node_info/node_info.sh
index ad0a5f9..4619d5e 100644
--- a/asterix-events/src/main/resources/events/node_info/node_info.sh
+++ b/asterix-events/src/main/resources/events/node_info/node_info.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,5 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
+
JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
echo "java_version=$JAVA_VERSION" 1>&2
diff --git a/asterix-events/src/main/resources/events/node_join/nc_join.sh b/asterix-events/src/main/resources/events/node_join/nc_join.sh
index 3dba3f8..035615d 100644
--- a/asterix-events/src/main/resources/events/node_join/nc_join.sh
+++ b/asterix-events/src/main/resources/events/node_join/nc_join.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
CC_HOST=$1
NC_ID=$2
IO_DEVICES=$3
diff --git a/asterix-events/src/main/resources/events/node_restart/nc_restart.sh b/asterix-events/src/main/resources/events/node_restart/nc_restart.sh
index 3912d9d..5ad6526 100644
--- a/asterix-events/src/main/resources/events/node_restart/nc_restart.sh
+++ b/asterix-events/src/main/resources/events/node_restart/nc_restart.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
CC_HOST=$1
NC_ID=$2
SLEEP_TIME=$3
diff --git a/asterix-events/src/main/resources/events/prepare.sh b/asterix-events/src/main/resources/events/prepare.sh
index e69de29..f1f641a 100644
--- a/asterix-events/src/main/resources/events/prepare.sh
+++ b/asterix-events/src/main/resources/events/prepare.sh
@@ -0,0 +1 @@
+#!/usr/bin/env bash
diff --git a/asterix-events/src/main/resources/events/restore/restore.sh b/asterix-events/src/main/resources/events/restore/restore.sh
index 5d25031..f77ee02 100644
--- a/asterix-events/src/main/resources/events/restore/restore.sh
+++ b/asterix-events/src/main/resources/events/restore/restore.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#*/
+
WORKING_DIR=$1
ASTERIX_INSTANCE_NAME=$2
ASTERIX_IODEVICES=$3
diff --git a/asterix-events/src/main/resources/scripts/execute.sh b/asterix-events/src/main/resources/scripts/execute.sh
index 658ffff..fc198ad 100644
--- a/asterix-events/src/main/resources/scripts/execute.sh
+++ b/asterix-events/src/main/resources/scripts/execute.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/asterix-events/src/main/resources/scripts/prepare.sh b/asterix-events/src/main/resources/scripts/prepare.sh
index 9af8792..cde3f59 100644
--- a/asterix-events/src/main/resources/scripts/prepare.sh
+++ b/asterix-events/src/main/resources/scripts/prepare.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/asterix-installer/src/main/resources/zookeeper/start_zk.sh b/asterix-installer/src/main/resources/zookeeper/start_zk.sh
old mode 100644
new mode 100755
index 0a2b51e..86769cd
--- a/asterix-installer/src/main/resources/zookeeper/start_zk.sh
+++ b/asterix-installer/src/main/resources/zookeeper/start_zk.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
#/*
# Copyright 2009-2013 by The Regents of the University of California
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#*/
+
ZK_HOME=$1
ZK_ID=$2
JAVA_HOME=$3
diff --git a/asterix-installer/src/main/resources/zookeeper/stop_zk b/asterix-installer/src/main/resources/zookeeper/stop_zk
index 9bef86e..84d9b74 100644
--- a/asterix-installer/src/main/resources/zookeeper/stop_zk
+++ b/asterix-installer/src/main/resources/zookeeper/stop_zk
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
ZK_HOME=$1
shift 1
for zk_host in $@
diff --git a/asterix-installer/src/main/resources/zookeeper/zk.init b/asterix-installer/src/main/resources/zookeeper/zk.init
index 8ef6f5f..6b26363 100644
--- a/asterix-installer/src/main/resources/zookeeper/zk.init
+++ b/asterix-installer/src/main/resources/zookeeper/zk.init
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
ZK_HOME=$1
SERVER_JAVA_HOME=$2
shift 2