File: a2d.init.d

package info (click to toggle)
a2d 2.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: javascript: 4,806; python: 1,873; xml: 49; sh: 44; makefile: 17
file content (48 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
. /lib/lsb/init-functions

### BEGIN INIT INFO
# Provides:          a2d
# Required-Start:    $remote_fs $syslog network-online.target
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: a2d HTML app
### END INIT INFO

# Change these values to match your application
APP_DIR="/usr/lib/python3/dist-packages/a2d"
APP_USER="a2d"
GUNICORN_CONFIG="/usr/lib/python3/dist-packages/a2d/gunicorn_config.py"

case "$1" in
  start)
    echo "Starting a2d HTML App..."
    cd $APP_DIR
    sudo -u $APP_USER /usr/bin/python3 -m gunicorn app:app -c $GUNICORN_CONFIG &
    ;;
  stop)
    echo "Stopping a2d HTML App..."
    pkill -f "gunicorn: master"
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  force-reload)
    echo "Reloading a2d HTML App..."
    $0 stop
    sleep 1
    $0 start
    ;;
  status)
    status_of_proc -p /var/run/a2d.pid "" "a2d HTML App"
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|force-reload|status}"
    exit 1
    ;;
esac

exit 0