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.
30 cmd="./dcae2_vm_init.sh"
34 pid_file="/var/run/$name.pid"
35 stdout_log="/var/log/$name.log"
36 stderr_log="/var/log/$name.err"
43 CID="$(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap')"
50 echo "Already started"
54 if [ -z "$user" ]; then
55 sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
57 sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
61 echo "Unable to start, see $stdout_log and $stderr_log"
68 echo -n "Stopping $name.."
70 CID=$(docker ps | grep 'nginx' | awk '{ print $1 }')
71 sudo docker stop "$CID"
73 CID=$(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap' | awk '{ print $1 }')
74 docker exec -it "$CID" ./teardown.sh
87 echo "Not stopped; may still be shutting down or shutdown may have failed"
91 if [ -f "$pid_file" ]; then
102 echo "Unable to stop, will not attempt to start"
116 echo "Usage: $0 {start|stop|restart|status}"