Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
#!/bin/bash
2
#
3
# /etc/rc.d/init.d/@name@
4
#
5
# chkconfig: @chkconfig@
6
# description: @desc@
7
# processname: @bin_name@
8
# pidfile: @pid_file@
9
PID_FILE=@pid_file@
10
BIN_FILE=@bin_file@
11
 
12
 
13
# Source function library.
14
. /etc/rc.d/init.d/functions
15
 
16
start() {
17
    ${BIN_FILE}
18
    ret=$?
19
    if [ $ret -eq 0 ]; then
20
        action $"Starting @name@: " /bin/true
21
    else
22
        action $"Starting @name@: " /bin/false
23
    fi
24
 
25
    return $ret
26
}
27
 
28
stop() {
29
    PID=`cat @pid_file@  2>/dev/null `
30
    if [ -n "$PID" ]; then
31
        /bin/kill "$PID" >/dev/null 2>&1
32
        ret=$?
33
        if [ $ret -eq 0 ]; then
34
            STOPTIMEOUT=60
35
            while [ $STOPTIMEOUT -gt 0 ]; do
36
                /bin/kill -0 "$PID" >/dev/null 2>&1 || break
37
                sleep 1
38
                let STOPTIMEOUT=${STOPTIMEOUT}-1
39
            done
40
            if [ $STOPTIMEOUT -eq 0 ]; then
41
                echo "Timeout error occurred trying to stop @name@."
42
                ret=1
43
                action $"Stopping @name@: " /bin/false
44
            else
45
                action $"Stopping @name@: " /bin/true
46
            fi
47
        else
48
            action $"Stopping @name@: " /bin/false
49
        fi
50
    else
51
        ret=1
52
        action $"Stopping @name@: " /bin/false
53
    fi
54
 
55
    return $ret
56
}
57
 
58
case "$1" in
59
    start)
60
        start
61
    ;;
62
    stop)
63
        stop
64
    ;;
65
    restart)
66
        stop
67
        start
68
    ;;
69
    reload)
70
        restart
71
    ;;
72
    status)
73
        status @name@
74
    ;;
75
    *)
76
        echo "Usage: @name@ [start|stop|restart|status]"
77
        exit 1
78
    ;;
79
esac