2 #############################################################################
4 # Copyright © 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 #############################################################################
22 # Required-Start: $remote_fs $syslog
23 # Required-Stop: $remote_fs $syslog
24 # Default-Start: 2 3 4 5
26 # Short-Description: Start daemon at boot time
27 # Description: Enable service provided by daemon.
31 cmd="./dcae_vm_init.sh"
35 pid_file="/var/run/$name.pid"
36 stdout_log="/var/log/$name.log"
37 stderr_log="/var/log/$name.err"
44 [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
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.."
82 echo "Not stopped; may still be shutting down or shutdown may have failed"
86 if [ -f "$pid_file" ]; then
97 echo "Unable to stop, will not attempt to start"
111 echo "Usage: $0 {start|stop|restart|status}"