2 #############################################################################
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 #############################################################################
20 # Provides: dcaegen2-bootstrap
21 # Required-Start: $remote_fs $syslog
22 # Required-Stop: $remote_fs $syslog
23 # Default-Start: 2 3 4 5
25 # Short-Description: Start daemon at boot time
26 # Description: Enable service provided by daemon.
28 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
29 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
31 if [ $HTTP_PROXY != " " ]
33 export http_proxy=$HTTP_PROXY
34 export https_proxy=$HTTPS_PROXY
38 cmd="./dcae2_vm_init.sh"
42 pid_file="/var/run/$name.pid"
43 stdout_log="/var/log/$name.log"
44 stderr_log="/var/log/$name.err"
51 CID="$(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap')"
58 echo "Already started"
62 if [ -z "$user" ]; then
63 sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
65 sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
69 echo "Unable to start, see $stdout_log and $stderr_log"
76 echo -n "Stopping $name.."
78 CID=$(docker ps | grep 'nginx' | awk '{ print $1 }')
79 sudo docker stop "$CID"
81 CID=$(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap' | awk '{ print $1 }')
82 docker exec -it "$CID" ./teardown.sh
95 echo "Not stopped; may still be shutting down or shutdown may have failed"
99 if [ -f "$pid_file" ]; then
110 echo "Unable to stop, will not attempt to start"
124 echo "Usage: $0 {start|stop|restart|status}"