diff options
Diffstat (limited to 'conductor/examples/distribution/ubuntu')
16 files changed, 964 insertions, 0 deletions
diff --git a/conductor/examples/distribution/ubuntu/init.d/conductor-api b/conductor/examples/distribution/ubuntu/init.d/conductor-api new file mode 100644 index 0000000..e67a9dc --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init.d/conductor-api @@ -0,0 +1,149 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: conductor-api +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Conductor API +# Description: Conductor API server +### END INIT INFO + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Conductor API" +PROJECT_NAME=conductor +NAME=${PROJECT_NAME}-api +PYTHON_HOME= +PORT=8091 + +#!/bin/sh +# The content after this line comes from openstack-pkg-tools +# and has been automatically added to a .init.in script, which +# contains only the descriptive part for the daemon. Everything +# else is standardized as a single unique script. + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ -z "${DAEMON}" ] ; then + if [ -d "${PYTHON_HOME}" ] ; then + DAEMON=${PYTHON_HOME}/bin/${NAME} + else + DAEMON=/usr/bin/${NAME} + fi +fi +PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid +if [ -z "${SCRIPTNAME}" ] ; then + SCRIPTNAME=/etc/init.d/${NAME} +fi +if [ -z "${SYSTEM_USER}" ] ; then + SYSTEM_USER=${PROJECT_NAME} +fi +if [ -z "${SYSTEM_GROUP}" ] ; then + SYSTEM_GROUP=${PROJECT_NAME} +fi +if [ "${SYSTEM_USER}" != "root" ] ; then + STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}" +fi +if [ -z "${CONFIG_FILE}" ] ; then + CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf +fi +LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log +if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}" +fi + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed +if [ `whoami` = "root" ] ; then + for i in lock run log lib ; do + mkdir -p /var/$i/${PROJECT_NAME} + chown ${SYSTEM_USER}:${SYSTEM_USER} /var/$i/${PROJECT_NAME} + done +fi + +# This defines init_is_upstart which we use later on (+ more...) +. /lib/lsb/init-functions + +# Manage log options: logfile and/or syslog, depending on user's choosing +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE" + +do_start() { + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + -- --port ${PORT} -- $DAEMON_ARGS || return 2 +} + +do_stop() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL=$? + rm -f $PIDFILE + return "$RETVAL" +} + +do_systemd_start() { + exec $DAEMON $DAEMON_ARGS +} + +case "$1" in +start) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +stop) + #init_is_upstart > /dev/null 2>&1 && exit 0 + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +status) + status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $? +;; +systemd-start) + do_systemd_start +;; +restart|force-reload) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case $? in + 0|1) + do_start + case $? in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) log_end_msg 1 ;; # Failed to stop + esac +;; +*) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2 + exit 3 +;; +esac + +exit 0 + diff --git a/conductor/examples/distribution/ubuntu/init.d/conductor-controller b/conductor/examples/distribution/ubuntu/init.d/conductor-controller new file mode 100644 index 0000000..f09d302 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init.d/conductor-controller @@ -0,0 +1,148 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: conductor-controller +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Conductor Controller +# Description: Conductor Controller server +### END INIT INFO + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Conductor Controller" +PROJECT_NAME=conductor +NAME=${PROJECT_NAME}-controller +PYTHON_HOME= + +#!/bin/sh +# The content after this line comes from openstack-pkg-tools +# and has been automatically added to a .init.in script, which +# contains only the descriptive part for the daemon. Everything +# else is standardized as a single unique script. + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ -z "${DAEMON}" ] ; then + if [ -d "${PYTHON_HOME}" ] ; then + DAEMON=${PYTHON_HOME}/bin/${NAME} + else + DAEMON=/usr/bin/${NAME} + fi +fi +PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid +if [ -z "${SCRIPTNAME}" ] ; then + SCRIPTNAME=/etc/init.d/${NAME} +fi +if [ -z "${SYSTEM_USER}" ] ; then + SYSTEM_USER=${PROJECT_NAME} +fi +if [ -z "${SYSTEM_GROUP}" ] ; then + SYSTEM_GROUP=${PROJECT_NAME} +fi +if [ "${SYSTEM_USER}" != "root" ] ; then + STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}" +fi +if [ -z "${CONFIG_FILE}" ] ; then + CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf +fi +LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log +if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}" +fi + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed +if [ `whoami` = "root" ] ; then + for i in lock run log lib ; do + mkdir -p /var/$i/${PROJECT_NAME} + chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME} + done +fi + +# This defines init_is_upstart which we use later on (+ more...) +. /lib/lsb/init-functions + +# Manage log options: logfile and/or syslog, depending on user's choosing +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE" + +do_start() { + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + -- $DAEMON_ARGS || return 2 +} + +do_stop() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL=$? + rm -f $PIDFILE + return "$RETVAL" +} + +do_systemd_start() { + exec $DAEMON $DAEMON_ARGS +} + +case "$1" in +start) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +stop) + #init_is_upstart > /dev/null 2>&1 && exit 0 + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +status) + status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $? +;; +systemd-start) + do_systemd_start +;; +restart|force-reload) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case $? in + 0|1) + do_start + case $? in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) log_end_msg 1 ;; # Failed to stop + esac +;; +*) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2 + exit 3 +;; +esac + +exit 0 + diff --git a/conductor/examples/distribution/ubuntu/init.d/conductor-data b/conductor/examples/distribution/ubuntu/init.d/conductor-data new file mode 100644 index 0000000..70b3e2f --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init.d/conductor-data @@ -0,0 +1,148 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: conductor-data +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Conductor Data +# Description: Conductor Data server +### END INIT INFO + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Conductor Data" +PROJECT_NAME=conductor +NAME=${PROJECT_NAME}-data +PYTHON_HOME= + +#!/bin/sh +# The content after this line comes from openstack-pkg-tools +# and has been automatically added to a .init.in script, which +# contains only the descriptive part for the daemon. Everything +# else is standardized as a single unique script. + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ -z "${DAEMON}" ] ; then + if [ -d "${PYTHON_HOME}" ] ; then + DAEMON=${PYTHON_HOME}/bin/${NAME} + else + DAEMON=/usr/bin/${NAME} + fi +fi +PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid +if [ -z "${SCRIPTNAME}" ] ; then + SCRIPTNAME=/etc/init.d/${NAME} +fi +if [ -z "${SYSTEM_USER}" ] ; then + SYSTEM_USER=${PROJECT_NAME} +fi +if [ -z "${SYSTEM_GROUP}" ] ; then + SYSTEM_GROUP=${PROJECT_NAME} +fi +if [ "${SYSTEM_USER}" != "root" ] ; then + STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}" +fi +if [ -z "${CONFIG_FILE}" ] ; then + CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf +fi +LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log +if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}" +fi + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed +if [ `whoami` = "root" ] ; then + for i in lock run log lib ; do + mkdir -p /var/$i/${PROJECT_NAME} + chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME} + done +fi + +# This defines init_is_upstart which we use later on (+ more...) +. /lib/lsb/init-functions + +# Manage log options: logfile and/or syslog, depending on user's choosing +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE" + +do_start() { + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + -- $DAEMON_ARGS || return 2 +} + +do_stop() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL=$? + rm -f $PIDFILE + return "$RETVAL" +} + +do_systemd_start() { + exec $DAEMON $DAEMON_ARGS +} + +case "$1" in +start) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +stop) + #init_is_upstart > /dev/null 2>&1 && exit 0 + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +status) + status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $? +;; +systemd-start) + do_systemd_start +;; +restart|force-reload) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case $? in + 0|1) + do_start + case $? in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) log_end_msg 1 ;; # Failed to stop + esac +;; +*) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2 + exit 3 +;; +esac + +exit 0 + diff --git a/conductor/examples/distribution/ubuntu/init.d/conductor-reservation b/conductor/examples/distribution/ubuntu/init.d/conductor-reservation new file mode 100644 index 0000000..6365b32 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init.d/conductor-reservation @@ -0,0 +1,148 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: conductor-reservation +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Conductor reservation +# Description: Conductor reservation server +### END INIT INFO + +# Author: Shankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Conductor Reservation" +PROJECT_NAME=conductor +NAME=${PROJECT_NAME}-reservation +PYTHON_HOME= + +#!/bin/sh +# The content after this line comes from openstack-pkg-tools +# and has been automatically added to a .init.in script, which +# contains only the descriptive part for the daemon. Everything +# else is standardized as a single unique script. + +# Author: Shankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ -z "${DAEMON}" ] ; then + if [ -d "${PYTHON_HOME}" ] ; then + DAEMON=${PYTHON_HOME}/bin/${NAME} + else + DAEMON=/usr/bin/${NAME} + fi +fi +PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid +if [ -z "${SCRIPTNAME}" ] ; then + SCRIPTNAME=/etc/init.d/${NAME} +fi +if [ -z "${SYSTEM_USER}" ] ; then + SYSTEM_USER=${PROJECT_NAME} +fi +if [ -z "${SYSTEM_GROUP}" ] ; then + SYSTEM_GROUP=${PROJECT_NAME} +fi +if [ "${SYSTEM_USER}" != "root" ] ; then + STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}" +fi +if [ -z "${CONFIG_FILE}" ] ; then + CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf +fi +LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log +if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}" +fi + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed +if [ `whoami` = "root" ] ; then + for i in lock run log lib ; do + mkdir -p /var/$i/${PROJECT_NAME} + chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME} + done +fi + +# This defines init_is_upstart which we use later on (+ more...) +. /lib/lsb/init-functions + +# Manage log options: logfile and/or syslog, depending on user's choosing +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE" + +do_start() { + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + -- $DAEMON_ARGS || return 2 +} + +do_stop() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL=$? + rm -f $PIDFILE + return "$RETVAL" +} + +do_systemd_start() { + exec $DAEMON $DAEMON_ARGS +} + +case "$1" in +start) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +stop) + #init_is_upstart > /dev/null 2>&1 && exit 0 + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +status) + status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $? +;; +systemd-start) + do_systemd_start +;; +restart|force-reload) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case $? in + 0|1) + do_start + case $? in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) log_end_msg 1 ;; # Failed to stop + esac +;; +*) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2 + exit 3 +;; +esac + +exit 0 + diff --git a/conductor/examples/distribution/ubuntu/init.d/conductor-solver b/conductor/examples/distribution/ubuntu/init.d/conductor-solver new file mode 100644 index 0000000..99cc98b --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init.d/conductor-solver @@ -0,0 +1,148 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: conductor-solver +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Conductor Solver +# Description: Conductor Solver server +### END INIT INFO + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Conductor Solver" +PROJECT_NAME=conductor +NAME=${PROJECT_NAME}-solver +PYTHON_HOME= + +#!/bin/sh +# The content after this line comes from openstack-pkg-tools +# and has been automatically added to a .init.in script, which +# contains only the descriptive part for the daemon. Everything +# else is standardized as a single unique script. + +# Author: Joe D'Andrea <jdandrea@research.att.com> +# Based on work by Thomas Goirand <zigo@debian.or> + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ -z "${DAEMON}" ] ; then + if [ -d "${PYTHON_HOME}" ] ; then + DAEMON=${PYTHON_HOME}/bin/${NAME} + else + DAEMON=/usr/bin/${NAME} + fi +fi +PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid +if [ -z "${SCRIPTNAME}" ] ; then + SCRIPTNAME=/etc/init.d/${NAME} +fi +if [ -z "${SYSTEM_USER}" ] ; then + SYSTEM_USER=${PROJECT_NAME} +fi +if [ -z "${SYSTEM_GROUP}" ] ; then + SYSTEM_GROUP=${PROJECT_NAME} +fi +if [ "${SYSTEM_USER}" != "root" ] ; then + STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}" +fi +if [ -z "${CONFIG_FILE}" ] ; then + CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf +fi +LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log +if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}" +fi + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed +if [ `whoami` = "root" ] ; then + for i in lock run log lib ; do + mkdir -p /var/$i/${PROJECT_NAME} + chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME} + done +fi + +# This defines init_is_upstart which we use later on (+ more...) +. /lib/lsb/init-functions + +# Manage log options: logfile and/or syslog, depending on user's choosing +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE" + +do_start() { + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \ + -- $DAEMON_ARGS || return 2 +} + +do_stop() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL=$? + rm -f $PIDFILE + return "$RETVAL" +} + +do_systemd_start() { + exec $DAEMON $DAEMON_ARGS +} + +case "$1" in +start) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Starting $DESC" "$NAME" + do_start + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +stop) + #init_is_upstart > /dev/null 2>&1 && exit 0 + log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case $? in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + esac +;; +status) + status_of_proc -p "${PIDFILE}" "$DAEMON" "$NAME" && exit 0 || exit $? +;; +systemd-start) + do_systemd_start +;; +restart|force-reload) + #init_is_upstart > /dev/null 2>&1 && exit 1 + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case $? in + 0|1) + do_start + case $? in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) log_end_msg 1 ;; # Failed to stop + esac +;; +*) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2 + exit 3 +;; +esac + +exit 0 + diff --git a/conductor/examples/distribution/ubuntu/init/conductor-api.conf b/conductor/examples/distribution/ubuntu/init/conductor-api.conf new file mode 100644 index 0000000..f6f805e --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init/conductor-api.conf @@ -0,0 +1,37 @@ +description "Conductor API" +author "Joe D'Andrea <jdandrea@research.att.com>" + +env PYTHON_HOME= +env PORT=8091 + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +respawn +limit nofile 65535 65535 + +pre-start script + for i in lock run log lib ; do + mkdir -p /var/$i/conductor + chown conductor:conductor /var/$i/conductor + done +end script + +script + DAEMON="/usr/bin/conductor-api" + [ -d "$PYTHON_HOME" ] && DAEMON="$PYTHON_HOME/bin/conductor-api" + [ -x "$DAEMON" ] || exit 0 + DAEMON_ARGS="" + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/conductor/conductor-api.log" + + exec start-stop-daemon --start --chdir /var/lib/conductor \ + --chuid conductor:conductor --make-pidfile --pidfile /var/run/conductor/conductor-engine.pid \ + --exec $DAEMON -- --port $PORT -- --config-file=/etc/conductor/conductor.conf ${DAEMON_ARGS} +end script + + diff --git a/conductor/examples/distribution/ubuntu/init/conductor-controller.conf b/conductor/examples/distribution/ubuntu/init/conductor-controller.conf new file mode 100644 index 0000000..9d44be2 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init/conductor-controller.conf @@ -0,0 +1,36 @@ +description "Conductor Controller" +author "Joe D'Andrea <jdandrea@research.att.com>" + +env PYTHON_HOME= + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +respawn +limit nofile 65535 65535 + +pre-start script + for i in lock run log lib ; do + mkdir -p /var/$i/conductor + chown conductor /var/$i/conductor + done +end script + +script + DAEMON="/usr/bin/conductor-controller" + [ -d "$PYTHON_HOME" ] && DAEMON="$PYTHON_HOME/bin/conductor-controller" + [ -x "$DAEMON" ] || exit 0 + DAEMON_ARGS="" + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/conductor/conductor-controller.log" + + exec start-stop-daemon --start --chdir /var/lib/conductor \ + --chuid conductor:conductor --make-pidfile --pidfile /var/run/conductor/conductor-controller.pid \ + --exec $DAEMON -- --config-file=/etc/conductor/conductor.conf ${DAEMON_ARGS} +end script + + diff --git a/conductor/examples/distribution/ubuntu/init/conductor-data.conf b/conductor/examples/distribution/ubuntu/init/conductor-data.conf new file mode 100644 index 0000000..643206d --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init/conductor-data.conf @@ -0,0 +1,36 @@ +description "Conductor Data" +author "Joe D'Andrea <jdandrea@research.att.com>" + +env PYTHON_HOME= + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +respawn +limit nofile 65535 65535 + +pre-start script + for i in lock run log lib ; do + mkdir -p /var/$i/conductor + chown conductor /var/$i/conductor + done +end script + +script + DAEMON="/usr/bin/conductor-data" + [ -d "$PYTHON_HOME" ] && DAEMON="$PYTHON_HOME/bin/conductor-data" + [ -x "$DAEMON" ] || exit 0 + DAEMON_ARGS="" + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/conductor/conductor-data.log" + + exec start-stop-daemon --start --chdir /var/lib/conductor \ + --chuid conductor:conductor --make-pidfile --pidfile /var/run/conductor/conductor-data.pid \ + --exec $DAEMON -- --config-file=/etc/conductor/conductor.conf ${DAEMON_ARGS} +end script + + diff --git a/conductor/examples/distribution/ubuntu/init/conductor-reservation.conf b/conductor/examples/distribution/ubuntu/init/conductor-reservation.conf new file mode 100644 index 0000000..0af5603 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init/conductor-reservation.conf @@ -0,0 +1,36 @@ +description "Conductor Reservation" +author "Shankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com>" + +env PYTHON_HOME= + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +respawn +limit nofile 65535 65535 + +pre-start script + for i in lock run log lib ; do + mkdir -p /var/$i/conductor + chown conductor /var/$i/conductor + done +end script + +script + DAEMON="/usr/bin/conductor-reservation" + [ -d "$PYTHON_HOME" ] && DAEMON="$PYTHON_HOME/bin/conductor-reservation" + [ -x "$DAEMON" ] || exit 0 + DAEMON_ARGS="" + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/conductor/conductor-reservation.log" + + exec start-stop-daemon --start --chdir /var/lib/conductor \ + --chuid conductor:conductor --make-pidfile --pidfile /var/run/conductor/conductor-reservation.pid \ + --exec $DAEMON -- --config-file=/etc/conductor/conductor.conf ${DAEMON_ARGS} +end script + + diff --git a/conductor/examples/distribution/ubuntu/init/conductor-solver.conf b/conductor/examples/distribution/ubuntu/init/conductor-solver.conf new file mode 100644 index 0000000..649c8c6 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/init/conductor-solver.conf @@ -0,0 +1,36 @@ +description "Conductor Solver" +author "Joe D'Andrea <jdandrea@research.att.com>" + +env PYTHON_HOME= + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +respawn +limit nofile 65535 65535 + +pre-start script + for i in lock run log lib ; do + mkdir -p /var/$i/conductor + chown conductor /var/$i/conductor + done +end script + +script + DAEMON="/usr/bin/conductor-solver" + [ -d "$PYTHON_HOME" ] && DAEMON="$PYTHON_HOME/bin/conductor-solver" + [ -x "$DAEMON" ] || exit 0 + DAEMON_ARGS="" + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/conductor/conductor-solver.log" + + exec start-stop-daemon --start --chdir /var/lib/conductor \ + --chuid conductor:conductor --make-pidfile --pidfile /var/run/conductor/conductor-solver.pid \ + --exec $DAEMON -- --config-file=/etc/conductor/conductor.conf ${DAEMON_ARGS} +end script + + diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-api b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-api new file mode 100644 index 0000000..8599adf --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-api @@ -0,0 +1,7 @@ +/var/log/conductor/conductor-api.log { + daily + missingok + compress + delaycompress + notifempty +} diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-common b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-common new file mode 100644 index 0000000..6efb26d --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-common @@ -0,0 +1,7 @@ +/var/log/conductor/*.log { + daily + missingok + compress + delaycompress + copytruncate +} diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-controller b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-controller new file mode 100644 index 0000000..af03403 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-controller @@ -0,0 +1,7 @@ +/var/log/conductor/conductor-controller.log { + daily + missingok + compress + delaycompress + notifempty +} diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-data b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-data new file mode 100644 index 0000000..1e4dc75 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-data @@ -0,0 +1,7 @@ +/var/log/conductor/conductor-data.log { + daily + missingok + compress + delaycompress + notifempty +} diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-reservation b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-reservation new file mode 100644 index 0000000..648d3e5 --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-reservation @@ -0,0 +1,7 @@ +/var/log/conductor/conductor-reservation.log { + daily + missingok + compress + delaycompress + notifempty +} diff --git a/conductor/examples/distribution/ubuntu/logrotate.d/conductor-solver b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-solver new file mode 100644 index 0000000..a433b9c --- /dev/null +++ b/conductor/examples/distribution/ubuntu/logrotate.d/conductor-solver @@ -0,0 +1,7 @@ +/var/log/conductor/conductor-solver.log { + daily + missingok + compress + delaycompress + notifempty +} |