summaryrefslogtreecommitdiff
path: root/news/inn/files/innd.sh
blob: 90494923e262ed635063050f58fb168495f87859 (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
#!/bin/sh
#
# $NetBSD: innd.sh,v 1.13 2002/09/29 10:39:36 jlam Exp $
#
# PROVIDE: inn
# REQUIRE: DAEMON
# KEYWORD: shutdown

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: @PKG_SYSCONFDIR@/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 )
		echo "Starting INN."
		su news -c "@PREFIX@/inn/bin/rc.news $1" >/dev/null
		exit 0
		;;
	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