blob: a0f62b9df6460b62b8cf5e875e137c52909aa21d (
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
|
#!/sbin/openrc-run
depend() {
need localmount
after bootmisc postgres
}
name="Quassel Core"
pidfile="/run/${RC_SVCNAME}.pid"
command="/usr/bin/quasselcore"
command_background="true"
QUASSEL_USER="${USER:-quassel}"
QUASSEL_GROUP="${GROUP:-quassel}"
command_user="$QUASSEL_USER:$QUASSEL_GROUP"
LOGLEVEL=${LOGLEVEL:-"Info"}
LOGFILE=${LOGFILE:-"/var/log/quassel.log"}
CONFIGDIR=${CONFIGDIR:-"/var/lib/quassel"}
command_args="--configdir='${CONFIGDIR}' \
--logfile='${LOGFILE}' --loglevel='${LOGLEVEL}' \
${LISTEN:+--listen='${LISTEN}'} ${PORT:+--port='${PORT}'}"
checkconfig() {
# check config folder
if [ ! -d "${CONFIGDIR}" ]; then
mkdir "${CONFIGDIR}" || return 1
fi
# permissions always changed just to avoid runtime issues
chown -R "$command_user" "${CONFIGDIR}" || return 1
# check log file
if [ ! -e "${LOGFILE}" ]; then
touch "${LOGFILE}" || return 1
fi
# permissions always changed just to avoid runtime issues
chown "$command_user" "${LOGFILE}" || return 1
}
start_pre() {
# If this isn't a restart, make sure that the user's config isn't
# busted before we try to start the daemon (this will produce
# better error messages than if we just try to start it blindly).
#
# If, on the other hand, this *is* a restart, then the stop_pre
# action will have ensured that the config is usable and we don't
# need to do that again.
if [ "${RC_CMD}" != "restart" ] ; then
checkconfig || return $?
fi
}
stop_pre() {
# If this is a restart, check to make sure the user's config
# isn't busted before we stop the running daemon.
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return $?
fi
}
|