From 4897093455a2bf08f3db3a1132cc2f6f5484d77c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 08:03:02 +0200 Subject: Adding upstream version 1:2.6.4. Signed-off-by: Daniel Baumann --- utils/statd/start-statd | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 utils/statd/start-statd (limited to 'utils/statd/start-statd') diff --git a/utils/statd/start-statd b/utils/statd/start-statd new file mode 100755 index 0000000..b11a7d9 --- /dev/null +++ b/utils/statd/start-statd @@ -0,0 +1,33 @@ +#!/bin/sh +# nfsmount calls this script when mounting a filesystem with locking +# enabled, but when statd does not seem to be running (based on +# /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> /run/rpc.statd.lock +flock -e 9 + +if [ -s /run/rpc.statd.pid ] && + [ "1$(cat /run/rpc.statd.pid)" -gt 1 ] && + kill -0 "$(cat /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. + if systemctl start rpc-statd.service; then + # Ensure systemd knows not to stop rpc.statd or its dependencies + # on 'systemctl isolate ..' + systemctl add-wants --runtime remote-fs.target rpc-statd.service + exit 0 + fi +fi + +cd / +# Fall back to launching it ourselves. +exec rpc.statd --no-notify -- cgit v1.2.3