aboutsummaryrefslogtreecommitdiff
path: root/hex-zero.wsgi
blob: 65972f688cfeceadb783aac7051467fdb763cff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
test -f /etc/default/hex-zero && . /etc/default/hex-zero
test -z "${UWSGI_USER}" && export UWSGI_USER=hex-zero
test -z "${UWSGI_BIN}" && export UWSGI_BIN=/usr/bin/uwsgi_python3
test -z "${LISTEN_HOST}" && export LISTEN_HOST=localhost
test -z "${LISTEN_PORT}" && export LISTEN_PORT=3031
test -z "${PIDFILE}" && export PIDFILE=/var/run/hex-zero.pid
test -z "${LOGFILE}" && export LOGFILE=/var/log/hex-zero/hex-zero.log
test -z "${UWSGI_OPTS}" && export UWSGI_OPTS="--http-socket ${LISTEN_HOST}:${LISTEN_PORT} --wsgi-file /var/www/hex-zero/hex_zero.py --callable app --log-x-forwarded-for --logto ${LOGFILE} --touch-reload /var/www/hex-zero/hex_zero.py --touch-reload /var/www/hex-zero/hex-zero.conf --pidfile ${PIDFILE} --uid ${UWSGI_USER}"

# check for short_url
/var/www/hex-zero/check-for-short_url.sh || exit 1

test -n "${FORCE_KILL_OLD_UWSGI}" && {
   ps -o user=,pid=,command:80= -u "${UWSGI_USER}" | awk '/hex-zero\.py/{print $2}' | xargs --no-run-if-empty kill
}

test "${USER}" != "root" && test "${USER}" != "${UWSGI_USER}" && test -n "${USER}" && {
   printf "Please run $0 as user root instead of ${USER}. It will downgrade permissions when running uwsgi. Aborted.\n" 1>&2 ; exit 1 ;
}

${UWSGI_BIN} ${UWSGI_OPTS}
bgstack15