#!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-db/mongodb/files/mms-agent.initd,v 1.3 2013/01/18 11:19:27 ultrabug Exp $ ROOTDIR=/opt/mms-agent PIDFILE=/var/run/mm-agent.pid EXEC="/usr/bin/env python agent.py" LOGFILE=/var/log/mongodb/mms-agent.log depend() { need net use syslog } start() { ebegin "Starting ${SVCNAME}" checkpath -d -m 0755 -o root:root /var/run/ # Setup API/SECRETY KEYS sed -i -e "s/^mms_key.*/mms_key = '${API_KEY}'/g" \ -e "s/^secret_key.*/secret_key = '${SECRET_KEY}'/g" ${ROOTDIR}/settings.py &>/dev/null # Tune the agent [ -z "${COLLECTION_INTERVAL}" ] || sed -i \ -e "s/^collection_interval.*/collection_interval = ${COLLECTION_INTERVAL}/g" ${ROOTDIR}/settings.py &>/dev/null [ -z "${CONF_INTERVAL}" ] || sed -i \ -e "s/^conf_interval.*/conf_interval = ${CONF_INTERVAL}/g" ${ROOTDIR}/settings.py &>/dev/null start-stop-daemon --start --chdir ${ROOTDIR} --exec ${EXEC} \ --pidfile "${PIDFILE}" --make-pidfile --background \ --user mongodb:mongodb --stdout ${LOGFILE} --stderr ${LOGFILE} eend $? } stop() { ebegin "Requesting ${SVCNAME} to stop" start-stop-daemon --stop --pidfile "${PIDFILE}" eend $? }