3 # Provides: conductor-controller
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 Controller
9 # Description: Conductor Controller 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
17 DESC="Conductor Controller"
18 PROJECT_NAME=conductor
19 NAME=${PROJECT_NAME}-controller
23 # The content after this line comes from openstack-pkg-tools
24 # and has been automatically added to a .init.in script, which
25 # contains only the descriptive part for the daemon. Everything
26 # else is standardized as a single unique script.
28 # Author: Joe D'Andrea <jdandrea@research.att.com>
29 # Based on work by Thomas Goirand <zigo@debian.or>
31 # PATH should only include /usr/* if it runs after the mountnfs.sh script
32 PATH=/sbin:/usr/sbin:/bin:/usr/bin
34 if [ -z "${DAEMON}" ] ; then
35 if [ -d "${PYTHON_HOME}" ] ; then
36 DAEMON=${PYTHON_HOME}/bin/${NAME}
38 DAEMON=/usr/bin/${NAME}
41 PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid
42 if [ -z "${SCRIPTNAME}" ] ; then
43 SCRIPTNAME=/etc/init.d/${NAME}
45 if [ -z "${SYSTEM_USER}" ] ; then
46 SYSTEM_USER=${PROJECT_NAME}
48 if [ -z "${SYSTEM_GROUP}" ] ; then
49 SYSTEM_GROUP=${PROJECT_NAME}
51 if [ "${SYSTEM_USER}" != "root" ] ; then
52 STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}"
54 if [ -z "${CONFIG_FILE}" ] ; then
55 CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf
57 LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log
58 if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then
59 DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}"
62 # Exit if the package is not installed
63 [ -x $DAEMON ] || exit 0
65 # If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed
66 if [ `whoami` = "root" ] ; then
67 for i in lock run log lib ; do
68 mkdir -p /var/$i/${PROJECT_NAME}
69 chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
73 # This defines init_is_upstart which we use later on (+ more...)
74 . /lib/lsb/init-functions
76 # Manage log options: logfile and/or syslog, depending on user's choosing
77 [ -r /etc/default/openstack ] && . /etc/default/openstack
78 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
79 [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
80 [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
83 start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
84 --test > /dev/null || return 1
85 start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
86 -- $DAEMON_ARGS || return 2
90 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
97 exec $DAEMON $DAEMON_ARGS
102 #init_is_upstart > /dev/null 2>&1 && exit 1
103 log_daemon_msg "Starting $DESC" "$NAME"
106 0|1) log_end_msg 0 ;;
111 #init_is_upstart > /dev/null 2>&1 && exit 0
112 log_daemon_msg "Stopping $DESC" "$NAME"
115 0|1) log_end_msg 0 ;;
120 status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $?
125 restart|force-reload)
126 #init_is_upstart > /dev/null 2>&1 && exit 1
127 log_daemon_msg "Restarting $DESC" "$NAME"
134 1) log_end_msg 1 ;; # Old process is still running
135 *) log_end_msg 1 ;; # Failed to start
138 *) log_end_msg 1 ;; # Failed to stop
142 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2