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.
29 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
30 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
32 if [ $HTTP_PROXY != "no_proxy" ]
34 export http_proxy=$HTTP_PROXY
35 export https_proxy=$HTTPS_PROXY
43 pid_file="/var/run/$name.pid"
44 stdout_log="/var/log/$name.log"
45 stderr_log="/var/log/$name.err"
52 [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
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.."
90 echo "Not stopped; may still be shutting down or shutdown may have failed"
94 if [ -f "$pid_file" ]; then
105 echo "Unable to stop, will not attempt to start"
119 echo "Usage: $0 {start|stop|restart|status}"