Clean up morss-helper
continuous-integration/drone/push Build is failing Details

master
pictuga 1 year ago
parent 8e9cc541b0
commit 8870400a6e

@ -1,21 +1,36 @@
#! /bin/sh
function run {
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
}
if [ "$1" = "sh" ] || [ "$1" = "bash" ]; then
exec $@
function daemon {
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - --daemon morss
}
elif [ -z "$1" ] || [ "$@" = "run" ]; then
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
function reload {
pid=$(pidof 'gunicorn: master [morss]') # NB. requires python-setproctitle
if [ -z "$pid" ]; then
# if gunicorn is not currently running
daemon
elif [ "$@" = "reload" ]; then
pid=$(pidof 'gunicorn: master [morss]')
kill -s USR2 $pid
kill -s WINCH $pid
kill -s TERM $pid
else
kill -s USR2 $pid
kill -s WINCH $pid
sleep 1 # give gunicorn some time to reload
kill -s TERM $pid
elif [ "$@" = "check" ]; then
fi
}
function check {
python -m morss.crawler http://localhost:${PORT:-8000}/ > /dev/null 2>&1
}
if [ "$1" = "sh" ] || [ "$1" = "bash" ] || [ "$(type -t "$1")" = "function" ]; then
$@
else
morss $@
python -m morss $@
fi

Loading…
Cancel
Save