Skip to content

Instantly share code, notes, and snippets.

@frederickding
Created July 10, 2021 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frederickding/3602e79151b087c2d9d046755164b5c5 to your computer and use it in GitHub Desktop.
Save frederickding/3602e79151b087c2d9d046755164b5c5 to your computer and use it in GitHub Desktop.
Basic openrc init file for traefik (/etc/init.d/traefik)
#!/sbin/openrc-run
LOG_FILE=/var/log/traefik.log
name="traefik"
command="/usr/local/bin/traefik"
command_args=" --log"
pidfile="/run/${RC_SVCNAME}.pid"
output_log=${LOG_FILE}
error_log=${LOG_FILE}
depend() {
need net
}
start() {
ebegin "Starting Traefik"
start-stop-daemon --background --start \
--exec "${command}" \
--make-pidfile --pidfile "${pidfile}" \
-- ${command_args}
eend $?
}
stop() {
ebegin "Stopping Traefik"
start-stop-daemon --stop --exec "${command}" \
--pidfile "${pidfile}"
eend $?
}
set -o allexport
if [ -f /usr/local/bin/traefik-env.sh ]; then source /usr/local/bin/traefik-env.sh; fi
set +o allexport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment