Files
bsd-apps/tinyice/includes/tinyice
tschettervictor c9c132dc3f tinyice: spacing
2026-04-21 08:37:57 -06:00

51 lines
1.5 KiB
Bash

#!/bin/sh
#
# Tinyice FreeBSD Service Script
#
# PROVIDE: tinyice
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Optional settings:
# tinyice_enable (YES/NO): Enable or disable the service.
# tinyice_host (IP): Service host.
# tinyice_port (port): Service port.
# tinyice_config (path): Path to application config directory.
# tinyice_daemon_user (user): User to run the service as.
# tinyice_daemon_group (group): Group to run the service as.
#
# TinyIce will not work properly when setting "tinyice_user" and "tinyice_group" variables
# therefore it is necessary to substitute "tinyice_user" with "tinyice_daemon_user"
# and have the daemon invoke the command as the user
. /etc/rc.subr
name=tinyice
desc="Tinyice Streaming Server"
rcvar=tinyice_enable
load_rc_config $name
: ${tinyice_enable:="NO"}
: ${tinyice_daemon_user:="tinyice"}
: ${tinyice_daemon_group:="tinyice"}
: ${tinyice_host:="0.0.0.0"}
: ${tinyice_port:="8000"}
: ${tinyice_config:="/usr/local/etc/tinyice/tinyice.json"}
pidfile="/var/run/${name}/${name}.pid"
command="/usr/sbin/daemon"
command_args="-u ${tinyice_daemon_user} -P ${pidfile} -H -o /var/log/${name}/${name}.log /usr/local/bin/${name} --config ${tinyice_config} --host ${tinyice_host} --port ${tinyice_port}"
start_precmd="tinyice_startprecmd"
tinyice_startprecmd()
{
mkdir -p /var/run/${name}
mkdir -p /var/log/${name}
chown -R ${tinyice_daemon_user}:${tinyice_daemon_group} /var/run/${name}
chown -R ${tinyice_daemon_user}:${tinyice_daemon_group} /var/log/${name}
}
run_rc_command "$1"