Files
Traefik/root/etc/init.d/traefik
Cantibra a7bc5462ba
All checks were successful
Traefik / Traefik (Bookworm) [arm64] (push) Successful in 1m10s
Traefik / Traefik (Bookworm) [amd64] (push) Successful in 1m19s
Inital Commit
2025-10-26 08:05:51 +01:00

88 lines
2.7 KiB
Bash

#!/usr/bin/sh
### BEGIN INIT INFO
# Provides: traefik
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Traefik Reverse Proxy
# Description: Traefik is an open-source reverse proxy and load balancer
# designed for microservices and containerized applications.
# It automatically discovers services and routes traffic
# based on defined rules. Traefik supports HTTP, HTTPS, and
# TCP protocols, offers automatic SSL certificate
# management, and provides a user-friendly dashboard for
# monitoring traffic and service health.
### END INIT INFO
NAME='traefik'
DESC='Traefik Reverse Proxy'
USER='traefik'
GROUP='traefik'
PIDFOLDER="/run/traefik"
PIDFILE="${PIDFOLDER}/traefik.pid"
DAEMON='/usr/sbin/traefik'
DAEMON_CONFIG='/etc/traefik/traefik.yml'
DAEMON_OPTS="--configfile ${DAEMON_CONFIG}"
set -e
[ -f "${DAEMON_CONFIG}" ]
. /lib/lsb/init-functions
[ -x "${DAEMON}" ]
case "${1}" in
start)
/usr/bin/install --directory --group="${GROUP}" ---mode='0755' --owner="${USER}" "${PIDFOLDER}"
log_daemon_msg "Starting ${DESC}" "${NAME}"
if /usr/sbin/start-stop-daemon --quiet \
--start \
--oknodo \
--make-pidfile \
--pidfile "${PIDFILE}" \
--user "${USER}" \
--group "${GROUP}" \
--exec "${DAEMON}" -- "${DAEMON_OPTS}"; then
log_end_msg 0
else
log_end_msg 1
/usr/bin/test -f "${PIDFILE}" && \
/usr/bin/rm --force "${PIDFILE}"
fi
;;
stop)
log_daemon_msg "Stopping ${DESC}" "${NAME}"
if /usr/sbin/start-stop-daemon --quiet \
--stop \
--oknodo \
--retry 30 \
--remove-pidfile \
--pidfile "${PIDFILE}" \
--user "${USER}" \
--group "${GROUP}" \
--exec "${DAEMON}"; then
/usr/bin/test -f "${PIDFILE}" && \
/usr/bin/rm --force "${PIDFILE}"
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
"${0}" stop
"${0}" start
;;
status)
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}" && \
exit 0 || \
exit "${?}"
;;
*)
echo "Usage: /etc/init.d/${NAME} {start|stop|restart|status}" >&2
exit 1
;;
esac