summaryrefslogtreecommitdiffstats
path: root/abs/core/runit-scripts/runitscripts/services/nfs-common/finish
blob: 531192d28e07e1db9742b6593f9f31718a8c854a (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/bash
exec 2>&1
export TERM=linux
daemon_name=nfs-common
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/$daemon_name.conf
                                    

# rpc.statd daemon & binary location
STATD_DAEMON_NAME=rpc.statd
STATD="/usr/sbin/rpc.statd"

# rpc.idmapd daemon & binary location
IDMAPD_DAEMON_NAME=rpc.idmapd
IDMAPD="/usr/sbin/rpc.idmapd"

# rpc.gssd daemon & binary location
GSSD_DAEMON_NAME=rpc.gssd
GSSD="/usr/sbin/rpc.gssd"

do_umount() {
    if mountpoint -q "$1" ; then
      umount "$1"
    fi
    return 0
}

get_pid() {
        pidof -o %PPID "$1"
}
        

stat_runit "Stopping $GSSD_DAEMON_NAME daemon"
PID=$(get_pid $GSSD)
[ ! -z "$PID" ] && kill $PID &> /dev/null
rm -f /var/run/$GSSD_DAEMON_NAME.pid &> /dev/null

stat_runit "Stopping $IDMAPD_DAEMON_NAME daemon"
PID=$(get_pid $IDMAPD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
 rm -f /var/run/$IDMAPD_DAEMON_NAME.pid &> /dev/null
do_umount "$PIPEFS_MOUNTPOINT" 2>/dev/null || true

stat_runit "Stopping $STATD_DAEMON_NAME daemon"
PID=$(get_pid $STATD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
rm -f /var/run/$STATD_DAEMON_NAME.pid &> /dev/null