blob: 86d655c94d6ce3569d2566854fcc64aa9178ee42 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#!/bin/sh -e
2### BEGIN INIT INFO
3# Provides: gateone
4# Required-Start: networking
5# Default-Start: 2 3 4 5
6# Default-Stop: 0 1 6
7# Short-Description: Gateone HTML5 ssh client
8# Description: Gateone HTML5 terminal emulator and SSH client.
9### END INIT INFO
10
11. /etc/init.d/functions
12
13NAME=gateone
14DAEMON=@bindir@/gateone
15PIDFILE=/run/gateone.pid
16WORKDIR=@localstate@/lib/gateone
17
18do_start() {
19 cd $WORKDIR
20 @bindir@/python $DAEMON > /dev/null 2>&1 &
21 cd $OLDPWD
22}
23
24do_stop() {
25 kill -TERM `cat $PIDFILE`
26}
27
28case "$1" in
29 start)
30 echo "Starting gateone"
31 do_start
32 ;;
33 stop)
34 echo "Stopping gateone"
35 do_stop
36 ;;
37 restart|force-reload)
38 echo "Restart gateone"
39 do_stop
40 sleep 1
41 do_start
42 ;;
43 *)
44 echo "Usage: $0 {start|stop|restart|force-reload}" >&2
45 exit 1
46 ;;
47esac