Skip to content

Commit

Permalink
Merge pull request #1533 from griidc/release/6.55.0
Browse files Browse the repository at this point in the history
Release/6.55.0
  • Loading branch information
fightingtexasaggie authored Feb 15, 2024
2 parents 441195e + 2fe1a35 commit 5f5c46d
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions share/bash/control-pelagos-messagemq-consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,56 @@
#
# This script is called by the pelagos-messagemq-consumer.service service with either a
# start or stop argument.
###############################################################################
# Configuration: #uncomment and modify as needed for your deployment
#
# Location of the supervisord.conf file
#supervisord_conf=/opt/pelagos/config/supervisor/supervisord.conf
# supervisord identifier
#identifier=pelagos
# user to run as
#runuser=pelagos
# Pelagos dir
#pelagos_dir=/opt/pelagos
#
# MUST EDIT $pelagos_dir/config/supervisor/supervisord.conf
# AND ALSO $pelagos_dir/config/supervisor/messenger-worker.ini
###############################################################################

# Get function from functions library
. /etc/init.d/functions

prog="pelagos-messagemq-consumer-supervisor"
runuser=pelagos

success=true;

# Start the service
start() {
echo -n $"Starting $prog: "
cd /opt/pelagos
cd $pelagos_dir

if su - $runuser -c "supervisord --configuration=/opt/pelagos/config/supervisor/supervisord.conf --identifier=pelagos" ; then
if su - $runuser -c "supervisord --configuration=$supervisord_conf --identifier=$identifier" ; then
echo "started supervisord"
else
echo "failed to start supervisord"
success=false
fi

if su - $runuser -c "supervisorctl --serverurl unix:///opt/pelagos/var/supervisor/supervisor.sock update" ; then
if su - $runuser -c "supervisorctl --serverurl unix://$pelagos_dir/var/supervisor/supervisor.sock update" ; then
echo "updated supervisor"
else
echo "failed to update supervisor"
success=false
fi

if su - $runuser -c "supervisorctl --serverurl unix:///opt/pelagos/var/supervisor/supervisor.sock reload" ; then
if su - $runuser -c "supervisorctl --serverurl unix://$pelagos_dir/var/supervisor/supervisor.sock reload" ; then
echo "reloaded supervisor"
else
echo "failed to reload supervisord"
success=false
fi

if su - $runuser -c "supervisorctl --serverurl unix:///opt/pelagos/var/supervisor/supervisor.sock start pelagos:*" ; then
if su - $runuser -c "supervisorctl --serverurl unix://$pelagos_dir/var/supervisor/supervisor.sock start pelagos:*" ; then
echo "started messenger consumer"
else
echo "failed to start the actual messenger consumer"
Expand All @@ -60,9 +74,9 @@ start() {

# Stop the service
stop() {
cd /opt/pelagos
cd $pelagos_dir

if su - $runuser -c "supervisorctl --serverurl unix:///opt/pelagos/var/supervisor/supervisor.sock stop pelagos:*" ; then
if su - $runuser -c "supervisorctl --serverurl unix://$pelagos_dir/var/supervisor/supervisor.sock stop pelagos:*" ; then
echo "stopped consumer"
else
success=false
Expand Down

0 comments on commit 5f5c46d

Please sign in to comment.