Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for leasetime and gracetime parameters #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion nfsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ else
/bin/sed -i "s/{{SYNC}}/sync/g" /etc/exports
fi

# Check if GRACE_TIME variable is set and use it
if [ -z ${GRACE_TIME+y} ]; then
echo "GRACE_TIME variable is unset"
GRACE_TIME_ARG=""
else
echo "GRACE_TIME variable is set to ${GRACE_TIME}"
GRACE_TIME_ARG="-G ${GRACE_TIME}"
fi

echo "Grace time argument = ${GRACE_TIME_ARG}"

# Check if LEASE_TIME variable is set and use it
if [ -z ${LEASE_TIME+y} ]; then
echo "LEASE_TIME variable is unset"
LEASE_TIME_ARG=""
else
echo "LEASE_TIME variable is set to ${GRACE_TIME}"
LEASE_TIME_ARG="-L ${LEASE_TIME}"
fi

echo "Lease time argument = ${LEASE_TIME_ARG}"

# Partially set 'unofficial Bash Strict Mode' as described here: http://redsymbol.net/articles/unofficial-bash-strict-mode/
# We don't set -e because the pidof command returns an exit code of 1 when the specified process is not found
# We expect this at times and don't want the script to be terminated when it occurs
Expand Down Expand Up @@ -105,7 +127,7 @@ while true; do
# /usr/sbin/rpc.statd

echo "Starting NFS in the background..."
/usr/sbin/rpc.nfsd --debug 8 --no-udp --no-nfs-version 2 --no-nfs-version 3
/usr/sbin/rpc.nfsd --debug 8 --no-udp --no-nfs-version 2 --no-nfs-version 3 ${GRACE_TIME_ARG} ${LEASE_TIME_ARG}
echo "Exporting File System..."
if /usr/sbin/exportfs -rv; then
/usr/sbin/exportfs
Expand Down