slackbuilds_ponce/network/tnfsd/rc.tnfsd
B. Watson 6b962c61dc network/tnfsd: Added (trivial network filesystem server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2022-07-25 15:22:44 +07:00

48 lines
1.3 KiB
Bash

#!/bin/sh
# rc.tnfsd, part of SBo tnfsd build, by B. Watson. WTFPL.
# To start tnfsd at boot, make this script executable, then add this code
# to /etc/rc.d/rc.local:
# [ -x /etc/rc.d/rc.tnfsd ] && /etc/rc.d/rc.tnfsd start
# tnfsd will chroot to $TNFS_ROOT and set its user ID to $TNFS_USER,
# and its group ID to $TNFS_USER's primary group. Since there's no
# other form of access control, make sure the $TNFS_USER can't wrote
# to $TNFS_ROOT, unless you want to allow everyone who can connect
# to write/delete/overwrite everything in $TNFS_ROOT. By default,
# /var/tnfs is owned by root:tnfs-files.
TNFS_USER=tnfsd
TNFS_ROOT=/var/tnfs
# Log gets overwritten on startup (no rotation).
TNFS_LOG=/var/log/tnfsd.log
# If you don't need the log at all. But if tnfsd fails to start, you
# won't see any error messages from it...
#TNFS_LOG=/dev/null
kill_tnfsd() {
/usr/bin/killall tnfsd && sleep 1
}
start_tnfsd() {
echo "Starting tnfsd."
kill_tnfsd &>/dev/null
/usr/bin/tnfsd "$TNFS_ROOT" -c "$TNFS_USER" >"$TNFS_LOG" </dev/null 2>&1 &
}
stop_tnfsd() {
echo "Stopping tnfsd."
kill_tnfsd
}
case "$1" in
""|start) start_tnfsd ;;
stop) stop_tnfsd ;;
restart) stop_tnfsd ; start_tnfsd ;;
*) echo "Usage: $0 stop|start|restart" 1&>2; exit 1 ;;
esac
exit 0