2e9b9da27dd3d01fcf5ebc304ac03b15142fde53
[so.git] /
1 #!/bin/sh
2 # Copyright 2015 AT&T Intellectual Properties
3 ##############################################################################
4 #       Script to initialize the chef-repo branch and.chef
5 #
6 ##############################################################################
7 # Copy the certificates
8 echo 'Copying the *.crt provided in /shared folder'
9 cp --verbose /shared/*.crt /usr/local/share/ca-certificates
10 update-ca-certificates
11
12 echo 'Running in JBOSS'
13 su - jboss
14
15 #Start the chef-solo
16 chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
17
18
19 JBOSS_PIDFILE=/tmp/jboss-standalone.pid
20 $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha-mso.xml &
21 JBOSS_PID=$!
22 # Trap common signals and relay them to the jboss process
23 trap "kill -HUP  $JBOSS_PID" HUP
24 trap "kill -TERM $JBOSS_PID" INT
25 trap "kill -QUIT $JBOSS_PID" QUIT
26 trap "kill -PIPE $JBOSS_PID" PIPE
27 trap "kill -TERM $JBOSS_PID" TERM
28 if [ "x$JBOSS_PIDFILE" != "x" ]; then
29   echo $JBOSS_PID > $JBOSS_PIDFILE
30 fi
31 # Wait until the background process exits
32 WAIT_STATUS=128
33 while [ "$WAIT_STATUS" -ge 128 ]; do
34    wait $JBOSS_PID 2>/dev/null
35    WAIT_STATUS=$?
36    if [ "$WAIT_STATUS" -gt 128 ]; then
37       SIGNAL=`expr $WAIT_STATUS - 128`
38       SIGNAL_NAME=`kill -l $SIGNAL`
39       echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2
40    fi
41 done
42 if [ "$WAIT_STATUS" -lt 127 ]; then
43    JBOSS_STATUS=$WAIT_STATUS
44 else
45    JBOSS_STATUS=0
46 fi
47 if [ "$JBOSS_STATUS" -ne 10 ]; then
48       # Wait for a complete shudown
49       wait $JBOSS_PID 2>/dev/null
50 fi
51 if [ "x$JBOSS_PIDFILE" != "x" ]; then
52       grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE
53 fi