ef4eb3fbeb422b73aae027b68f77714d1ce8d0e7
[ctdb.git] / config / events.d / 49.winbind
1 #!/bin/sh
2 # ctdb event script for winbind
3
4 [ -n "$CTDB_BASE" ] || \
5     export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
6
7 . $CTDB_BASE/functions
8
9 detect_init_style
10
11 CTDB_SERVICE_WINBIND=${CTDB_SERVICE_WINBIND:-winbind}
12
13 service_name="winbind"
14
15 loadconfig
16
17 ctdb_setup_service_state_dir
18
19 service_start ()
20 {
21     service "$CTDB_SERVICE_WINBIND" stop >/dev/null 2>&1
22     killall -0 -q winbindd && {
23         sleep 1
24         # make absolutely sure winbindd is dead
25         killall -q -9 winbindd
26     }
27
28     service "$CTDB_SERVICE_WINBIND" start || \
29         die "Failed to start winbind"
30 }
31
32 service_stop ()
33 {
34     service "$CTDB_SERVICE_WINBIND" stop
35 }
36
37 ###########################
38
39 ctdb_start_stop_service
40
41 is_ctdb_managed_service || exit 0
42
43 ctdb_service_check_reconfigure
44
45 ###########################
46
47 case "$1" in 
48      startup)
49         ctdb_service_start
50         ;;
51         
52      shutdown)
53         ctdb_service_stop
54         ;;
55
56      monitor)
57         ctdb_check_command wbinfo -p
58         ;;
59
60      takeip|releaseip)
61         iface=$2
62         ip=$3
63         maskbits=$4
64
65         smbcontrol winbindd ip-dropped $ip >/dev/null 2>/dev/null
66         ;;
67     *)
68         ctdb_standard_event_handler "$@"
69         ;;
70 esac
71
72 exit 0