blob: bbf4f41b7508a385e1092cfab7b93f303fd5f58c (
plain) (
blame)
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
|
#!/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"
fi
case "${command}" in
kill|restart|status|terminate)
eval ${ctrl} ${command};;
stop)
eval ${ctrl} terminate;;
start|*)
MakeWorkingDirectory
eval ${start};;
esac
exit
|