2 ################################################################################
3 # Copyright (c) 2019 AT&T Intellectual Property. #
4 # Copyright (c) 2019 Nokia. #
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 #
10 # http://www.apache.org/licenses/LICENSE-2.0 #
12 # Unless required by applicable law or agreed to in writing, software #
13 # distributed under the License is distributed on an "AS IS" BASIS, #
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 # See the License for the specific language governing permissions and #
16 # limitations under the License. #
17 ################################################################################
19 # Provides: k8s_vm_init.sh
20 # Required-Start: $remote_fs $syslog
21 # Required-Stop: $remote_fs $syslog
22 # Default-Start: 2 3 4 5
24 # Short-Description: Start daemon at boot time
25 # Description: Enable service provided by daemon.
28 echo "k8s_vm_init_serv.sh"
32 cmd="./k8s_vm_init.sh"
36 pid_file="/var/run/$name.pid"
37 stdout_log="/var/log/$name.log"
38 stderr_log="/var/log/$name.err"
45 [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
51 echo "Already started"
55 if [ -z "$user" ]; then
56 sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
58 sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
62 echo "Unable to start, see $stdout_log and $stderr_log"
69 echo -n "Stopping $name.."
83 echo "Not stopped; may still be shutting down or shutdown may have failed"
87 if [ -f "$pid_file" ]; then
98 echo "Unable to stop, will not attempt to start"
112 echo "Usage: $0 {start|stop|restart|status}"