# routing file to read
#ROUTES_FILE=/etc/carbon-c-relay.conf
-# where to store the PID-file
-#PIDFILE=/run/carbon-c-relay.pid
-
# where to store the logfile
#LOGFILE=/var/log/carbon-c-relay.log
command="/usr/bin/carbon-c-relay"
command_args="-f ${routes_config} ${EXTRA_OPTS}"
-pidfile=${PIDFILE:-/run/${SVCNAME}.pid}
+pidfile="/run/carbon-c-relay/${SVCNAME}.pid"
logfile=${LOGFILE:-/var/log/${SVCNAME}.log}
user=${USER:-carbon}
group=${GROUP:-carbon}
configtest || return 1
fi
touch "${logfile}"
- chown ${user}:${group} "${logfile}"
+ mkdir -p "${pidfile%/*}"
+ chown ${user}:${group} "${logfile}" "${pidfile%/*}"
}
stop_pre() {
stop() {
ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --stop --exec ${command} --pidfile "${pidfile}"
+ # migration path
+ local pfile=${pidfile}
+ [[ -e /run/carbon-c-relay.pid ]] && pfile="/run/carbon-c-relay.pid"
+ start-stop-daemon --stop --exec ${command} --pidfile "${pfile}"
eend $?
}