summaryrefslogtreecommitdiff
path: root/news/inn/files/innd.sh
blob: f53fd2d1cf627167375fa4e46112a2efe91392b8 (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
#!/bin/sh
#
# $NetBSD: innd.sh,v 1.8 2001/02/08 16:23:06 tron Exp $

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