Browse Source

WR324938: Changed checkcoce.sh to check if passenger is running

based on if the passenger.8080.pid exists AND has a PID number

Also changed the restartcoce.sh file so the cd and passenger-start
commands are not sudo or in ``
pull/1/head
Alex Buckley 4 years ago
parent
commit
cc33168935
  1. 29
      koha-coce/checkcoce.sh
  2. 37
      koha-coce/restartcoce.sh

29
koha-coce/checkcoce.sh

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# This file is part of Koha.
#
# Copyright (C) 2019 Catalyst IT
@ -10,28 +10,29 @@
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
set -e
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
else
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
exit 1;
cocestatus=0
passengerpid="/var/local/coce/passenger.8080.pid"
if [ ! -f "$passengerpid" ]; then
echo "PID file ($passengerpid) does not exist"
cocestatus=1
fi
cocestatus=0
if !`sudo passenger-status`; then
cocestatus=0
PID=`cat $passengerpid`
if ps -p $PID > /dev/null; then
echo "$PID is running"
cocestatus=0
else
cocestatus=1
echo "$PID is not running"
cocestatus=1
fi
echo $cocestatus
exit $cocestatus

37
koha-coce/restartcoce.sh

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/sh
# This file is part of Koha.
#
# Copyright (C) 2017 Catalyst IT
# Copyright (C) 2019 Catalyst IT
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -16,30 +16,25 @@
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
set -e
. /lib/lsb/init-functions
# Read configuration variable file if it is present
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
else
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
exit 1
passengerpid="/var/local/coce/passenger.8080.pid"
if [ ! -f "$passengerpid" ]; then
echo "PID file ($passengerpid) does not exist"
cd /var/local/coce
passenger start --port 8080 --daemonize
fi
if !`sudo koha-passenger`; then
`cd /var/local/coce`
`sudo passenger start --port 8080 --daemonize`
PID=`cat $passengerpid`
if ps -p $PID > /dev/null; then
echo "Passnger is running - do nothing"
else
`cd /var/local/coce`
`sudo passenger start --port 8080 --daemonize`
cd /var/local/coce
passenger start --port 8080 --daemonize
fi
if !`sudo koha-passenger`; then
if [ ! -f "$passengerpid" ]; then
warn "The passenger instance is not running"
elif ps -p $PID > /dev/null; then
warn "The passenger instance is now running"
else
warn "The passenger instance is not running"

Loading…
Cancel
Save