3 # Provides: conductor-api
4 # Required-Start: $network $local_fs $remote_fs $syslog
5 # Required-Stop: $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Conductor API
9 # Description: Conductor API server
12 # Author: Joe D'Andrea <jdandrea@research.att.com>
13 # Based on work by Thomas Goirand <zigo@debian.or>
15 # PATH should only include /usr/* if it runs after the mountnfs.sh script
16 PATH=/sbin:/usr/sbin:/bin:/usr/bin
18 PROJECT_NAME=conductor
19 NAME=${PROJECT_NAME}-api
24 # The content after this line comes from openstack-pkg-tools
25 # and has been automatically added to a .init.in script, which
26 # contains only the descriptive part for the daemon. Everything
27 # else is standardized as a single unique script.
29 # Author: Joe D'Andrea <jdandrea@research.att.com>
30 # Based on work by Thomas Goirand <zigo@debian.or>
32 # PATH should only include /usr/* if it runs after the mountnfs.sh script
33 PATH=/sbin:/usr/sbin:/bin:/usr/bin
35 if [ -z "${DAEMON}" ] ; then
36 if [ -d "${PYTHON_HOME}" ] ; then
37 DAEMON=${PYTHON_HOME}/bin/${NAME}
39 DAEMON=/usr/bin/${NAME}
42 PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid
43 if [ -z "${SCRIPTNAME}" ] ; then
44 SCRIPTNAME=/etc/init.d/${NAME}
46 if [ -z "${SYSTEM_USER}" ] ; then
47 SYSTEM_USER=${PROJECT_NAME}
49 if [ -z "${SYSTEM_GROUP}" ] ; then
50 SYSTEM_GROUP=${PROJECT_NAME}
52 if [ "${SYSTEM_USER}" != "root" ] ; then
53 STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}"
55 if [ -z "${CONFIG_FILE}" ] ; then
56 CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf
58 LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log
59 if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then
60 DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}"
63 # Exit if the package is not installed
64 [ -x $DAEMON ] || exit 0
66 # If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed
67 if [ `whoami` = "root" ] ; then
68 for i in lock run log lib ; do
69 mkdir -p /var/$i/${PROJECT_NAME}
70 chown ${SYSTEM_USER}:${SYSTEM_USER} /var/$i/${PROJECT_NAME}
74 # This defines init_is_upstart which we use later on (+ more...)
75 . /lib/lsb/init-functions
77 # Manage log options: logfile and/or syslog, depending on user's choosing
78 [ -r /etc/default/openstack ] && . /etc/default/openstack
79 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
80 [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
81 [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
84 start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
85 --test > /dev/null || return 1
86 start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
87 -- --port ${PORT} -- $DAEMON_ARGS || return 2
91 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
98 exec $DAEMON $DAEMON_ARGS
103 #init_is_upstart > /dev/null 2>&1 && exit 1
104 log_daemon_msg "Starting $DESC" "$NAME"
107 0|1) log_end_msg 0 ;;
112 #init_is_upstart > /dev/null 2>&1 && exit 0
113 log_daemon_msg "Stopping $DESC" "$NAME"
116 0|1) log_end_msg 0 ;;
121 status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $?
126 restart|force-reload)
127 #init_is_upstart > /dev/null 2>&1 && exit 1
128 log_daemon_msg "Restarting $DESC" "$NAME"
135 1) log_end_msg 1 ;; # Old process is still running
136 *) log_end_msg 1 ;; # Failed to start
139 *) log_end_msg 1 ;; # Failed to stop
143 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2