Closed (fixed)
Project:
Hosting queue runner
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Nov 2011 at 20:20 UTC
Updated:
13 Jul 2012 at 19:41 UTC
I used the following steps to configure this on centos:
29 cd /var/aegir/hostmaster-6.x-1.5/sites/aegirnt2.uqam.ca/modules/hosting_queue_runner/
30 cp init.d.example /etc/init.d/aegir
31 chmod a+x /etc/init.d/aegir
74 chkconfig aegir on
75 chkconfig --list aegir
The init.d had to be patched as it is debian-specific, here is the result:
#!/bin/sh
### BEGIN INIT INFO
# Provides: hosting-queue-runner
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Queue runner daemon for Aegir
# Description: This module allows the Hosting tasks queue for the
# Aegir project to be 'daemonized' so that tasks
# are run as soon as possible instead of waiting
# for a cron run. This makes Aegir appear much more
# responsive.
### END INIT INFO
# Author: Antoine Beaupré <anarcat@koumbit.org>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Aegir queue runner" # Introduce a short description here
NAME="hosting-queue-runner" # Introduce the short server's name here
DAEMON=/usr/local/bin/drush # Introduce the server's location here
DAEMON_ARGS="@hostmaster $NAME" # Arguments to run the daemon with
USER="aegir"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
#. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
su - aegir /usr/local/bin/drush @hostmaster hosting-queue-runner &
echo $! > $PIDFILE
}
#
# Function that stops the daemon/service
#
do_stop()
{
if [ -e $PIDFILE ]; then
kill `cat $PIDFILE`
rm -f $PIDFILE
else
echo "no pid file found"
fi
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && echo "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && echo "ok" ;;
2) [ "$VERBOSE" != no ] && echo "FAIL" ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && echo ok ;;
2) [ "$VERBOSE" != no ] && echo FAIL ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
echo "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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
Comments
Comment #1
leenx commentedThis script does not work for me. Wonder if anybody else has put any effort in and got it working. I'm running on CentOS6, that might be the problem.
Comment #2
anarcat commentedThis has been merged into Aegir 2.x core, and is now the default startup script. The Debian startup script is now distinct, in the debian package, but this can be used by non-Debian distributions.
Here's the magic script: http://drupalcode.org/project/hostmaster.git/blob_plain/refs/heads/6.x-2...