wok-next view fail2ban/stuff/etc/init.d/fail2ban @ 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 0cdb4f15eec5
children
line source
1 #!/bin/sh
2 # /etc/init.d/fail2ban: Start, stop and restart Apache web server on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 NAME=Fail2ban
10 DESC="$(_ '%s server' Fail2ban)"
11 DAEMON=/usr/bin/fail2ban-client
12 OPTIONS=
13 PIDFILE=/var/run/fail2ban/fail2ban.pid
14 SOCKET=/var/run/fail2ban/fail2ban.sock
16 case "$1" in
17 start)
18 if active_pidfile $PIDFILE fail2ban-server ; then
19 _ '%s is already running.' $NAME
20 exit 1
21 fi
22 action 'Starting %s: %s...' "$DESC" $NAME
23 rm -f $SOCKET
24 $DAEMON start >/dev/null
25 status
26 ;;
27 stop)
28 action 'Stopping %s: %s...' "$DESC" $NAME
29 $DAEMON stop
30 rm -f $PIDFILE
31 status
32 ;;
33 reload)
34 if ! active_pidfile $PIDFILE fail2ban-server ; then
35 _ '%s is not running.' $NAME
36 exit 1
37 fi
38 action 'Stopping %s: %s...' "$DESC" $NAME
39 $DAEMON stop
40 status
41 ;;
42 restart)
43 if ! active_pidfile $PIDFILE fail2ban-server ; then
44 _ '%s is not running.' $NAME
45 exit 1
46 fi
47 action 'Restarting %s: %s...' "$DESC" $NAME
48 $0 stop
49 $0 start
50 status
51 ;;
52 *)
53 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
54 newline
55 exit 1
56 ;;
57 esac
59 exit 0