Last active
May 30, 2018 06:16
-
-
Save j0inty/3af03e8ef42d88dac62fb1062a62991a to your computer and use it in GitHub Desktop.
Icecast2 Streaming Daemon init.d for OpenRC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/openrc-run | |
# Copyright 1999-2016 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
RUNAS="${RUNAS:-icecast}" | |
RUNGROUP="${RUNGROUP:-nogroup}" | |
CONFIG_FILE="${CONFIG_FILE:-/etc/icecast2/icecast.xml}" | |
pidfile="${PIDFILE:-/run/icecast2/server.pid}" | |
name="Icecast2 Streaming Daemon" | |
description="Icecast is a streaming media server which currently supports WebM and Ogg streaming including the Opus, Vorbis and Theora codecs." | |
description_reload="Send the SIGHUP to the daemon and the process id of running daemon can be found in ${pidfile}" | |
required_files="${CONFIG_FILE}" | |
command="/usr/bin/icecast" | |
command_args="-c ${CONFIG_FILE}" | |
command_background="true" | |
extra_started_commands="reload" | |
depend() { | |
need net | |
# We should be after bootmisc so that /run is cleaned before we put our pidfile there. | |
after bootmisc | |
} | |
start_pre() { | |
# Creating the pid file directory | |
checkpath --directory --owner ${RUNAS}:${RUNGROUP} --mode 0775 "$(dirname "${pidfile}")" | |
# Checking that the RECORDING_DIR exists and give only icecast access on it | |
if [ -n "${RECORDING_DIR}" ]; then | |
checkpath --directory --owner ${RUNAS}:${RUNGROUP} --mode 0700 "${RECORDING_DIR}" | |
fi | |
} | |
reload() { | |
ebegin "Reloading ${name} configuration" | |
start-stop-daemon --signal HUP --pidfile ${PIDFILE} | |
eend $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment