summaryrefslogtreecommitdiff
path: root/news/inn/files/innd.sh
blob: 2af59926419162e8c0bd8a9a87bdb7363c175648 (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: innd.sh,v 1.9 2001/02/20 15:10:53 tron Exp $
#
# PROVIDE: inn
# REQUIRE: DAEMON

if [ -x @@PREFIX@@/inn/bin/rc.news -a -s @@INN_DATA_DIR@@/db/active ]
then
	if [ ! -f @@PREFIX@@/etc/nntp/server ]
	then
		hostname >@@PREFIX@@/etc/nntp/server
	fi

	if [ ! -f @@PREFIX@@/etc/nntp/domainname ]
	then
		(set - X `grep ^fromhost: @@INN_DATA_DIR@@/etc/inn.conf`
		if [ $# -eq 3 ]
		then
			echo $3 >@@PREFIX@@/etc/nntp/domainname
		fi)
	fi

	if [ $# -eq 0 ]
	then
		echo -n ' innd'
		su news -c "@@PREFIX@@/inn/bin/rc.news start" >/dev/null
		exit 0
	fi

	case "$1" in
	start | stop)
		su news -c "@@PREFIX@@/inn/bin/rc.news $1"
		exit 0
		;;
	restart )
		$0 stop
		sleep 5
		exec $0 start
		;;
	* )
		echo "Usage: $0 (start|stop|restart)"
		exit 1
		;;
	esac
fi

exit 0