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

55 lines
964 B
Plaintext
Raw Normal View History

#!/bin/sh -e -
#
# $FreeBSD$
#
# startup script for ndtpd
# Usage: ndtpd.sh {start|stop}
command=$1
standalone=YES # Run ndtpd as a standalone daemon.
#standalone=NO # Run ndtpd as a child of inetd.
GetDirective() {
local directive
directive=$1
awk '/^[ ]*'${directive}'[ ]+/ {print $2; exit}' ${conf}
}
MakeWorkingDirectory() {
local user group work
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
ndtpcheck -c ${conf} || exit
case "${command}" in
start)
MakeWorkingDirectory
if [ "${standalone}" = YES ]; then
ndtpd && echo -n " ndtpd"
fi
;;
stop)
if [ "${standalone}" = YES ]; then
ndtpcontrol terminate && echo -n " ndtpd"
fi
;;
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 22
;;
esac
exit