Hello
In trying Seafile CE 7.1.3 for the first time, i found that ./seahub.sh stop was not stopping the Gunicorn master and child processes. It thinks it has, and therefore deletes the PID and which then results in processes that can only be killed with KILL or otherwise ./seahub.sh won’t be able to start the process again.
In particular, I refer to LINES 236 and 238, pkill -9 -f “thirdpart/bin/gunicorn”
What is thirdpart?
Changing the line to pkill -9 -f “gunicorn”
allows ./seahub.sh stop to work as intended
BUT
that would kill ALL Gunicorn processes on the host even if they are not part of this particular instance of Seafile.
SINCE
The PID is know, why doesn’t ./seahub.sh stop just do
kill -9 ${pidfile}
Being a beginner with Seafile, I’m sure someone will enlighten me.
Thanks
OK, I see a bit more…
Gunicorn is included in Seafile, at
./seafile-server-7.1.3/seahub/thirdpart/bin/gunicorn
(Initially I must have miss-typed when going looking for it.)
But I have gunicorn and python-gunicorn (and 3s as well) installed on this machine!
So, thirdpart/bin/gunicorn wasnt being found, and /usr/bin/gunicorn found instead.
But I still don’t know why
kill -9 ${pidfile}
isn’t good enough
My solution …
function stop_seahub () {
if [[ -f ${pidfile} ]]; then
echo "Stopping seahub ..."
#pkill -9 -f "gunicorn"
PID=$( pgrep -F $pidfile )
kill -9 $PID
sleep 5
#if pgrep -f "gunicorn" 2>/dev/null 1>&2 ; then
if [[ $( pgrep -P $PID ) ]]; then
echo 'Failed to stop seahub.'
exit 1
fi
rm -f ${pidfile}
return 0
else
echo "Seahub is not running"
fi
}
But systemd services know how to stop things they start, so I don’t use it now