diff options
Diffstat (limited to 'network/tnfsd/rc.tnfsd')
-rw-r--r-- | network/tnfsd/rc.tnfsd | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/network/tnfsd/rc.tnfsd b/network/tnfsd/rc.tnfsd new file mode 100644 index 0000000000000..392856115a494 --- /dev/null +++ b/network/tnfsd/rc.tnfsd @@ -0,0 +1,48 @@ +#!/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 |