wok view ajaxterm/stuff/etc/init.d/ajaxterm @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents 297964ebacad
children
line source
1 #!/bin/sh
2 # /etc/init.d/ajaxterm : Start, stop and restart AjaxTerm server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start AjaxTerm server at boot time, just put ajaxterm in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=AjaxTerm
12 DESC="$(_ '%s server' AjaxTerm)"
13 DAEMON="/usr/share/ajaxterm/ajaxterm.py"
14 OPTIONS=$AJAXTERM_OPTIONS
15 PIDFILE=/var/run/ajaxterm.pid
16 [ -n "$OPTIONS" ] || OPTIONS="--pidfile $PIDFILE --daemon --port=8022 --command=/usr/share/ajaxterm/login"
17 export PYTHONPATH=/usr/share/ajaxterm
19 case "$1" in
20 start)
21 if active_pidfile $PIDFILE python ; then
22 _ '%s is already running.' $NAME
23 exit 1
24 fi
25 action 'Starting %s: %s...' "$DESC" $NAME
26 $DAEMON $OPTIONS
27 status
28 sleep 2
29 ;;
30 stop)
31 if ! active_pidfile $PIDFILE python ; then
32 _ '%s is not running.' $NAME
33 exit 1
34 fi
35 action 'Stopping %s: %s...' "$DESC" $NAME
36 kill $(cat $PIDFILE)
37 status
38 rm -f $PIDFILE
39 sleep 2
40 ;;
41 restart)
42 if ! active_pidfile $PIDFILE python ; then
43 _ '%s is not running.' $NAME
44 exit 1
45 fi
46 action 'Restarting %s: %s...' "$DESC" $NAME
47 kill $(cat $PIDFILE)
48 rm -f $PIDFILE
49 sleep 2
50 $DAEMON $OPTIONS
51 status
52 sleep 2
53 ;;
54 *)
55 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
56 newline
57 exit 1
58 ;;
59 esac
61 exit 0