2000-01-22 06:40:20 +00:00
|
|
|
#!/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"
|
1999-08-19 10:50:30 +00:00
|
|
|
fi
|
2000-01-22 06:40:20 +00:00
|
|
|
|
|
|
|
case "${command}" in
|
|
|
|
kill|restart|status|terminate)
|
|
|
|
eval ${ctrl} ${command};;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
eval ${ctrl} terminate;;
|
|
|
|
|
|
|
|
start|*)
|
|
|
|
MakeWorkingDirectory
|
|
|
|
eval ${start};;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit
|