aboutsummaryrefslogtreecommitdiff
path: root/network/keepalived/rc.keepalived
blob: fc063fa1fe6d0e3731e3286ab7d658c057bd289e (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
#!/bin/sh
#
# Startup script for the Keepalived daemon
#
# This is the modified version from the original for the
# Slackware.
#
# This version was modified in 2010 by Nilton Moura,
# the original author of the SlackBuild Script for keepalived.
#
# Sript simplified, removed dependency of optional sysvinit-functions
# package and moved daemon options to /etc/default
# in 2020 by Marek Wodzinski <majek@w7i.pl>

# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/default/keepalived

start() {
    echo "Starting keepalived"
    /usr/sbin/keepalived ${KEEPALIVED_OPTIONS}
}

stop() {
    echo "Stopping keepalived "
    pkill -TERM keepalived 1>/dev/null 2>/dev/null
}

reload() {
    echo "Reloading keepalived"
    pkill -1  keepalived
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    reload)
        reload
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: $0 {start|stop|reload|restart}"
        exit 1
esac