blob: 3abaa419a306dbe5d071b7c1271bc4f463311a34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/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
|