summaryrefslogtreecommitdiff
path: root/textproc/ndtpd/files/ndtpd.sh
blob: c2c9c5f8f1d7e6dc9debafe54cc8638bb39a906f (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
#!/bin/sh
#
# $NetBSD: ndtpd.sh,v 1.2 2002/04/02 15:59:50 uebayasi Exp $
#
# PROVIDE: ndtpd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# To start ndtpd at startup, copy this script to /etc/rc.d and set
# ndtpd=YES in /etc/rc.conf.

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

name="ndtpd"
rcvar="$name"
prog=@PREFIX@/sbin/ndtpd
pidfile=@NDTPD_RUNDIR@/ndtpd/ndtpd.pid

case $1 in
start)
	@ECHO@ "Starting ${name}."
	@MKDIR@ @NDTPD_RUNDIR@/ndtpd
	${prog} >/dev/null 2>&1 || {
		@ECHO@ "Configuration error?" >&2
		@ECHO@ "Try @PREFIX@/sbin/ndtpcheck" >&2
		exit 1
	}
	;;
stop)
	@ECHO@ "Stopping ${name}."
	if [ -f ${pidfile} ]; then
		pid=`@HEAD@ -1 ${pidfile}`
		kill -s TERM ${pid}
		@RM@ -fr @NDTPD_RUNDIR@/ndtpd
	else
		@ECHO@ "${name} not running?"
		exit 1
	fi
	;;
*)
	@ECHO@ "Usage: $0 [start|stop]" 1>&2
	exit 1
	;;
esac

exit 0