mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-05 22:43:24 +00:00
aa19923bc9
- 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)
55 lines
964 B
Bash
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
|