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
Akinori MUSHA aa19923bc9 - Update to the latest version ja-ndtpd-2.3.8 (patched).
- Refine startup script.
    o Be friends with `/etc/rc.shutdown'.
    o Accept only standard arguments.
    o Add a $FreeBSD$ keyword.

PR:		ports/20836
Submitted by:	Kazu TAKAMUNE <takamune@avrl.mei.co.jp> (MAINTAINER)
2000-08-29 20:16:57 +00:00

55 lines
964 B
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
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