1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-05 22:43:24 +00:00
freebsd-ports/japanese/ebnetd/files/ndtpd.sh.sample

50 lines
967 B
Plaintext
Raw Normal View History

#!/bin/sh -e -
# startup script for ndtpd
# Usage: ndtpd.sh [kill|restart|status|terminate|stop|start]
command=$1
standalone=YES # Run ndtpd as a standalone daemon.
#standalone=NO # Run ndtpd as a child of inetd.
GetDirective() {
directive=$1
awk '/^[ ]*'${directive}'[ ]+/ {print $2; exit}' ${conf}
}
MakeWorkingDirectory() {
user="`GetDirective user`"
group="`GetDirective group`"
work="`GetDirective work-path`"
rm -rf ${work:=@rundir@/ndtpd}
eval install -d ${user:+-o ${user}} ${group:+-g ${group}} ${work}
}
conf=@prefix@/etc/ndtpd.conf
[ -f ${conf} ] || exit
ndtpcheck || exit
if [ "${standalone}" = YES ]; then
ctrl=ndtpcontrol
start="echo -n ' ndtpd'; ndtpd"
else
ctrl="echo 'Error: inetd invokes ndtpd.' >&2; false"
fi
case "${command}" in
kill|restart|status|terminate)
eval ${ctrl} ${command};;
stop)
eval ${ctrl} terminate;;
start|*)
MakeWorkingDirectory
eval ${start};;
esac
exit