blob: ae08a5a58ffb7c756234e11765703d5e169beb72 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#!/sbin/openrc-run
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# Derived from the rc.news shell script.
# shellcheck shell=bash
extra_commands="daily"
extra_started_commands="reload"
description_reload="Reload the INN configuration."
description_daily="Perform daily Usenet maintenance tasks."
command=/opt/inn/bin/innd
command_args="${INND_OPTS}"
pidfile=/run/news/innd.pid
depend() {
need net
use ovdb innwatch cnfsstat
}
daily() {
ebegin "Executing news.daily"
/opt/inn/bin/news.daily ${INND_NEWSDAILY_OPTS}
eend $?
}
expirerm() {
local rmfile=/var/log/news/expire.rm
for f in ${rmfile} ${rmfile}.*; do
if [ -s "${f}" ]; then
/opt/inn/bin/expirerm "${f}"
fi
done
}
start_pre() {
local active=/var/db/news/active
local old_newsdaily=$(find /var/db/news/.news.daily -mtime +1 -print 2>/dev/null)
if [ ! -f /var/db/news/.news.daily ] || [ -n "${old_newsdaily}" ]; then
daily
fi
if [ -f ${pidfile} ] || [ -f /run/news/.rebuildoverview ] || [ ! -s ${active} ]; then
# active needs to be renumbered
command_args="${command_args} -r"
fi
# active file recovery
if [ ! -s ${active} ]; then
if [ -s ${active}.tmp ]; then
mv ${active}.tmp ${active} || return 1
elif [ -s ${active}.old ]; then
cp ${active}.old ${active} || return 1
else
eerror "${RC_SVCNAME} failed to start: ${active} does not exist"
return 1
fi
fi
# remove temporary batchfiles and lock files
rm -f /var/spool/news/outgoing/bch*
rm -f /run/news/LOCK*
rm -f /run/news/control /run/news/nntpin /run/news/.rebuildoverview
expirerm
}
stop() {
ebegin "Stopping ${RC_SVCNAME}"
/opt/inn/bin/ctlinnd throttle "OpenRC service stop"
/opt/inn/bin/ctlinnd shutdown "OpenRC service stop"
eend $?
}
reload() {
ebegin "Reloading innd configuration"
/opt/inn/bin/ctlinnd -t 20 reload "" "OpenRC service reload"
eend $?
}
|