75 lines
1.8 KiB
Plaintext
75 lines
1.8 KiB
Plaintext
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2013 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: $
|
||
|
|
||
|
OPSICONFDCONFIG=/etc/opsi/opsiconfd.conf
|
||
|
OPSICONFDPROGRAM=/usr/bin/opsiconfd
|
||
|
|
||
|
[ -x $OPSICONFDPROGRAM ] || exit 0
|
||
|
|
||
|
OPSICONFDCONFIG_OPT=""
|
||
|
[ ! -z $OPSICONFDCONFIG -a -f $OPSICONFDCONFIG ] && OPSICONFDCONFIG_OPT="-c $OPSICONFDCONFIG"
|
||
|
|
||
|
USER=opsiconfd
|
||
|
LOGDIR=/var/log/opsi/opsiconfd
|
||
|
PIDDIR=/var/run/opsiconfd
|
||
|
LIBDIR=/var/lib/opsiconfd
|
||
|
MBUSDIR=/var/run/opsi-message-bus
|
||
|
RRDDIR=${LIBDIR}/rrd
|
||
|
PIDFILE=${PIDDIR}/opsiconfd.pid
|
||
|
GUARD_BIN=/usr/bin/opsiconfd-guard
|
||
|
GLOBAL_CONF=/etc/opsi/global.conf
|
||
|
|
||
|
|
||
|
|
||
|
depend() {
|
||
|
need net
|
||
|
}
|
||
|
|
||
|
start() {
|
||
|
# Make sure files are writable
|
||
|
[ ! -e ${LOGDIR} ] && mkdir -p ${LOGDIR}
|
||
|
chown -R ${USER} ${LOGDIR}
|
||
|
[ ! -e ${LIBDIR} ] && mkdir -p ${LIBDIR}
|
||
|
chown -R ${USER} ${LIBDIR}
|
||
|
[ ! -e ${RRDDIR} ] && mkdir -p ${RRDDIR}
|
||
|
chown -R ${USER} ${RRDDIR}
|
||
|
[ ! -e ${PIDDIR} ] && mkdir -p ${PIDDIR}
|
||
|
chown -R ${USER} ${PIDDIR}
|
||
|
[ ! -e ${MBUSDIR} ] && mkdir -p ${MBUSDIR}
|
||
|
chown -R ${USER} ${MBUSDIR}
|
||
|
|
||
|
if [ "$START_GUARD" = "1" ]; then
|
||
|
ebegin "Starting opsi guard"
|
||
|
start-stop-daemon --start \
|
||
|
--exec ${GUARD_BIN} -- ${OPSIGUARD_OPTIONS}
|
||
|
eend $?
|
||
|
fi
|
||
|
|
||
|
ebegin "Starting opsi config service"
|
||
|
start-stop-daemon --start \
|
||
|
--user ${USER} \
|
||
|
--pidfile ${PIDFILE} \
|
||
|
--exec ${OPSICONFDPROGRAM} -- -D ${OPSICONFDCONFIG_OPT} ${OPSICONFD_OPTIONS}
|
||
|
eend $?
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
if [ "$START_GUARD" = "1" ]; then
|
||
|
ebegin "Stopping opsi guard"
|
||
|
# Kill opsiconfd-guard
|
||
|
killall $(basename $GUARD_BIN) >/dev/null 2>/dev/null || true
|
||
|
#start-stop-daemon --stop \
|
||
|
# --name $(basename ${GUARD_BIN}) \
|
||
|
# --exec ${GUARD_BIN} -- ${OPSIGUARD_OPTIONS}
|
||
|
eend $?
|
||
|
fi
|
||
|
|
||
|
ebegin "Stopping opsi config service"
|
||
|
start-stop-daemon --stop \
|
||
|
--pidfile ${PIDFILE} \
|
||
|
--exec ${OPSICONFDPROGRAM} -- ${OPSICONFDCONFIG_OPT}
|
||
|
eend $?
|
||
|
}
|