freebsd-ports/japanese/ebnetd/files/ndtpd.sh.sample
Ying-Chieh Liao 0258697314 handle sh more properly
Submitted by:	hrs
2001-08-18 19:35:06 +00:00

57 lines
1 KiB
Bash

#!/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
ndtpd=@prefix@/sbin/ndtpd
ndtpcheck=@prefix@/sbin/ndtpcheck
ndtpcontrol=@prefix@/sbin/ndtpcontrol
${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