/
boot_as_master
executable file
·51 lines (43 loc) · 1.44 KB
/
boot_as_master
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Copyright 2013-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the
# License. A copy of the License is located at
#
# http://aws.amazon.com/asl/
#
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
# limitations under the License.
set -x
. /opt/cfncluster/cfnconfig
function error_exit () {
script=`basename $0`
echo "cfncluster: $script - $1"
logger -t cfncluster "$script - $1"
exit 1
}
# Run preinstall script if defined
RC=0
if [ "${cfn_preinstall}" != "NONE" ]; then
wget -qO- ${cfn_preinstall} | /bin/sh || RC=1
fi
if [ $RC -ne 0 ]; then
error_exit "Failed to run boot_as_master preinstall"
fi
# Run boot as master for a specific scheduler
RC=0
/opt/cfncluster/scripts/${cfn_scheduler}/boot_as_master >/var/log/cfncluster.log 2>&1 || RC=1
if [ $RC -ne 0 ]; then
error_exit "Failed to run boot_as_master for ${cfn_scheduler}"
fi
# Start sqswatcher
cd /opt/cfncluster/sqswatcher && ./sqswatcher.py 2>&1
# Run postinstall script if defined
RC=0
if [ "${cfn_postinstall}" != "NONE" ]; then
wget -qO- ${cfn_postinstall} | /bin/sh || RC=1
fi
if [ $RC -ne 0 ]; then
error_exit "Failed to run boot_as_master postinstall"
fi