tempestas

A REST API for processing sensor.community data
git clone https://git.bracken.jp/tempestas.git
Log | Files | Refs | README | LICENSE

commit 5c2cff6ac55f62a6f88b7221718424ada6d1ff3f
parent b4b69659b636f95c25c749d8d7f299fb2899e104
Author: Chris Bracken <chris@bracken.jp>
Date:   Mon, 11 Apr 2022 19:02:27 -0700

FreeBSD: add etc/rc.d/tempestas service script

Adds a service script to be installed to /usr/local/etc/rc.d on FreeBSD.

Diffstat:
Aetc/rc.d/tempestas | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+), 0 deletions(-)

diff --git a/etc/rc.d/tempestas b/etc/rc.d/tempestas @@ -0,0 +1,57 @@ +#!/bin/sh + +# PROVIDE: tempestas +# REQUIRE: LOGIN cleanvar +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable tempestas: +# tempestas_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable tempestas +# tempestaslimits_enable (bool): Set to "NO" by default. +# Set it to yes to run `limits $limits_args` +# just before tempestas starts. +# tempestas_flags (str): Set to "" by default. +# Extra flags passed to start command. +# tempestaslimits_args (str): Default to "-e -U tempestas" +# Arguments of pre-start limits run. + +. /etc/rc.subr + +name="tempestas" +rcvar=tempestas_enable + +command="/usr/local/bin/tempestas" +tempestas_user="tempestas" +pidfile="/var/run/${name}.pid" + +start_cmd="tempestas_start" +stop_cmd="tempestas_stop" +status_cmd="tempestas_status" + +[ -z "$tempestas_enable" ] && tempestas_enable="NO" +[ -z "$tempestas_flags" ] && tempestas_flags="" + +load_rc_config $name + +tempestas_start() { + /usr/sbin/daemon -P "${pidfile}" -r -f -S -T tempestas -u ${tempestas_user} "${command}" ${tempestas_flags} +} + +tempestas_stop() { + if [ -e "${pidfile}" ]; then + kill -s TERM `cat ${pidfile}` + else + echo "${name} is not running" + fi +} + +tempestas_status() { + if [ -e "${pidfile}" ]; then + echo "${name} is running as pid `cat ${pidfile}`" + else + echo "${name} is not running" + fi +} + +run_rc_command "$1"