File: sample.init.script

package info (click to toggle)
inn2 2.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,720 kB
  • ctags: 8,983
  • sloc: ansic: 92,499; sh: 13,509; perl: 12,921; makefile: 2,985; yacc: 842; python: 342; lex: 255
file content (58 lines) | stat: -rw-r--r-- 1,568 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
49
50
51
52
53
54
55
56
57
58
#! /bin/sh

# $Id: sample.init.script 9599 2014-02-08 13:56:54Z iulius $
#
# This is a simple, bare-bones example of a SysV-style init.d script for INN.
# It tries to increase the file descriptor limits to the maximum allowed by
# the system since INN and related programs can be file descriptor hogs.

test -f '<pathbin>/rc.news' || exit 0

start () {
    ulimit -n unlimited
    # Start INN.
    su news -s /bin/sh -c '<pathbin>/rc.news' >> <pathlog>/rc.news 2>&1
    # Start another nnrpd daemon, handling initial TLS connections, on port 563.
    # (The preferred way would be to use port 119 and STARTTLS but not all news
    # readers support it yet.)
    #su news -s /bin/sh -c '<pathbin>/nnrpd -D -p 563 -S' >> <pathlog>/rc.news 2>&1
}

case "$1" in

start)
    start
    ;;

stop)
    # Stop INN.
    su news -s /bin/sh -c '<pathbin>/rc.news stop' >> <pathlog>/rc.news 2>&1
    # Stop possible other nnrpd daemons.  One of the two following commands is enough.
    #start-stop-daemon --stop --name nnrpd --quiet --oknodo
    #su news -s /bin/sh -c 'killall nnrpd' >> <pathlog>/rc.news 2>&1
    ;;

reload|force-reload)
    # Reload INN.
    <pathbin>/ctlinnd -t 20 reload '' 'reload asked'
    ;;

restart)
    # Restart INN.
    if [ -f '<pathrun>/innd.pid' ]; then
        <pathbin>/ctlinnd -t 20 throttle 'restart asked' > /dev/null || true
        <pathbin>/ctlinnd -t 20 xexec innd > /dev/null || start
    else
        start
    fi
    ;;

*)
    echo "Recognized arguments:  start|stop|reload|force-reload|restart" >&2
    exit 1
    ;;

esac

exit 0