ports/misc/py-glance/files/glance-api.in
Roman Bogorodskiy 4ccb86a7b4 misc/py-glance: rc scripts improvement
- run glance services as 'glance' user instead of 'root'
 - fix an issue with stopping of the glance-api service
   (where it was spawning a new glance-api worker on SIGTERM)
 - automatically create log directories
 - add glance-glare rc script
 - bump PORTREVISION

PR:		214741
Submitted by:	maintainer
2016-11-27 11:58:23 +00:00

61 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: glance_api
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable glance_api:
#
# glance_api_enable="YES"
#
# glance_api_enable (bool):
# Set it to "YES" to enable glance_api.
# Default is "NO".
#
# glance_api_logdir (str):
# Set it to chagge log directory
# Default is "/var/log/glance"
#
# glance_api_args (str):
# Set it to change command line arguments.
# Default is "--log-file ${glance_api_logdir}/glance-api.log"
#
. /etc/rc.subr
name=glance_api
rcvar=glance_api_enable
required_files=%%PREFIX%%/etc/glance/glance-api.conf
PATH=%%PREFIX%%/bin:%%PREFIX%%/sbin:$PATH
pidfile="/var/run/glance-api.pid"
procname="%%PREFIX%%/bin/python2.7"
start_precmd=glance_precmd
stop_postcmd=glance_postcmd
load_rc_config $name
: ${glance_api_enable:="NO"}
: ${glance_api_logdir:="/var/log/glance"}
: ${glance_api_args:="--log-file ${glance_api_logdir}/glance-api.log"}
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} -u glance glance-api ${glance_api_args}"
glance_precmd() {
mkdir -p ${glance_api_logdir}
chown glance ${glance_api_logdir}
}
glance_postcmd() {
# this is a workaround for a glance-api bug
pkill -u glance -f glance-api
}
run_rc_command "$1"