summaryrefslogtreecommitdiffstats
path: root/config/cobblerd
blob: e32fcfc6f0c66b31a26a236499fc6b8962a2d3c9 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
#
# cobblerd    Cobbler helper daemon
#
# chkconfig: 345 99 99 
# description:  This is a daemon that provides remote cobbler info to koan
#               clients and also logs installer yslog activitity. 
#
# processname: /usr/bin/cobblerd

# Sanity checks.
[ -x /usr/bin/cobblerd ] || exit 0

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

start() {
    echo -n $"Starting cobbler daemon: "
    if test -f /var/lock/subsys/cobblerd ; then
        echo_failure
        echo
        return 1
    fi
    /usr/bin/cobblerd
    RETVAL=$?
    echo_success
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cobblerd
    return $RETVAL
}


stop() {
    echo -n $"Stopping cobbler daemon: "
    if ! test -f /var/lock/subsys/cobblerd ; then
        echo_failure
        echo
        return 1
    fi
    rm /var/lock/subsys/cobblerd
    echo_success
    echo
    pkill -9 cobblerd >/dev/null 2>/dev/null
    RETVAL=$?
    return $RETVAL
}

mystatus() {
    if test -f /var/lock/subsys/cobblerd ; then
        echo "cobbblerd is running..."
        return 0
    fi
    echo "cobblerd is stopped"
    echo
    return 0
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        mystatus
        RETVAL=$?
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/cobblerd ]; then
            stop
            start
        fi
        ;;
    reload)
        echo "can't reload configuration, you have to restart it"
        RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        ;;
esac
exit $RETVAL