diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-09-19 00:19:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 00:19:03 +0200 |
commit | b8b2a943056adbb112474df7bdf766970a56b2dc (patch) | |
tree | ac62e6bcd7d795066ce66256a6fdf2d1be101514 /vagrant_support/hypnotoad | |
parent | 2f3ca2822570ae271ca4603b5d3de119b40d9eb8 (diff) | |
download | bugzilla-b8b2a943056adbb112474df7bdf766970a56b2dc.tar.gz bugzilla-b8b2a943056adbb112474df7bdf766970a56b2dc.tar.xz |
Bug 1455495 - Replace apache with Mojolicious
Diffstat (limited to 'vagrant_support/hypnotoad')
-rwxr-xr-x | vagrant_support/hypnotoad | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/vagrant_support/hypnotoad b/vagrant_support/hypnotoad new file mode 100755 index 000000000..5e8dc910e --- /dev/null +++ b/vagrant_support/hypnotoad @@ -0,0 +1,122 @@ +#!/bin/bash +# +# bugzilla-push This starts, stops, and restarts the Bugzilla push +# daemon, which manages syncronising bugzilla.mozilla.org and +# third party bugzilla installs. +# +# chkconfig: 345 85 15 +# description: Bugzilla push daemon +# +### BEGIN INIT INFO +# Provides: bugzilla-push +# Required-Start: $local_fs $syslog MTA mysqld +# Required-Stop: $local_fs $syslog MTA mysqld +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start and stop the Bugzilla push daemon. +# Description: The Bugzilla push daemon (bugzilla-pushd.pl) +# +# +# +### END INIT INFO + +NAME=`basename $0` + +################# +# Configuration # +################# + +# This should be the path to your Bugzilla +BUGZILLA=/vagrant +# Who owns the Bugzilla directory and files? +USER=vagrant + +PERL5LIB="$BUGZILLA:$BUGZILLA/lib:$BUGZILLA/local/lib/perl5" +export PERL5LIB +export MOJO_MODE + +if [[ x$PORT == x ]]; then + PORT=80 + export PORT +fi + +# If you want to pass any options to the daemon (like -d for debugging) +# specify it here. +OPTIONS="" + +# You can also override the configuration by creating a +# /etc/sysconfig/bugzilla-queue file so that you don't +# have to edit this script. +if [ -r /etc/sysconfig/$NAME ]; then + . /etc/sysconfig/$NAME +fi + +########## +# Script # +########## + +RETVAL=0 +BIN="$BUGZILLA/local/bin/hypnotoad" +PIDFILE="$BUGZILLA/hypnotoad.pid" + +# Source function library. +. /etc/rc.d/init.d/functions + +usage () +{ + echo "Usage: service $NAME {start|stop|status|restart|condrestart}" + RETVAL=1 +} + + +start () +{ + if [[ -f $PIDFILE ]]; then + checkpid "$(cat $PIDFILE)" && return 0 + fi + echo -n "Starting $NAME: " + daemon --pidfile=$PIDFILE --user=$USER "cd $BUGZILLA && $BIN bugzilla.pl >/dev/null" + ret=$? + [ $ret -eq "0" ] && touch /var/lock/subsys/$NAME + echo + return $ret +} + +stop () +{ + cd $BUGZILLA && $BIN bugzilla.pl --stop + rm -f /var/lock/subsys/$NAME +} + +restart () +{ + stop + start +} + +condrestart () +{ + [ -e /var/lock/subsys/$NAME ] && restart || return 0 +} + +status () +{ + if [[ -f $PIDFILE ]] && checkpid "$(cat $PIDFILE)"; then + echo hypnotoad is amazing + return 0 + else + echo hypnotoad is not running + return 1 + fi +} + +case "$1" in + start) start; RETVAL=$? ;; + stop) stop; RETVAL=$? ;; + status) status; RETVAL=$?;; + restart) restart; RETVAL=$? ;; + condrestart) condrestart; RETVAL=$? ;; + *) usage ; RETVAL=2 ;; +esac + +exit $RETVAL |