File: start-statd

package info (click to toggle)
nfs-utils 1%3A1.3.4-2.1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,000 kB
  • sloc: ansic: 36,344; sh: 4,948; python: 1,342; makefile: 764
file content (28 lines) | stat: -rwxr-xr-x 838 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# nfsmount calls this script when mounting a filesystem with locking
# enabled, but when statd does not seem to be running (based on
# /var/run/rpc.statd.pid).
# It should run statd with whatever flags are apropriate for this
# site.
PATH="/sbin:/usr/sbin:/bin:/usr/bin"

# Use flock to serialize the running of this script
exec 9> /var/run/rpc.statd.lock
flock -e 9

if [ -s /var/run/rpc.statd.pid ] &&
       [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] &&
       kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1
then
    # statd already running - must have been slow to respond.
    exit 0
fi
# First try systemd if it's installed.
if [ -d /run/systemd/system ]; then
    # Quit only if the call worked.
    systemctl start rpc-statd.service && exit
fi

cd /
# Fall back to launching it ourselves.
exec rpc.statd --no-notify