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