mirror of
https://github.com/hassio-addons/addon-debian-base.git
synced 2025-05-07 04:31:30 +00:00
✨ Adds systemd service emulator for S6
This commit is contained in:
parent
176081eb9d
commit
919937e4f5
1 changed files with 33 additions and 0 deletions
33
debian-base/rootfs/usr/bin/service
Executable file
33
debian-base/rootfs/usr/bin/service
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Base Images
|
||||
# This script patches all service commands into the appropriate s6- commands
|
||||
# Why not systemd? Docker said no, so did we ;)
|
||||
# ==============================================================================
|
||||
|
||||
start() {
|
||||
s6-svc -wU -u -T2500 "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
stop() {
|
||||
s6-svc -wD -d -T2500 "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
status() {
|
||||
s6-svstat "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
service="$1"
|
||||
command="$2"
|
||||
|
||||
if [[ ! -d "/var/run/s6/services/${service}" ]] ; then
|
||||
echo "s6 service not found for ${service}, exiting..."
|
||||
exit
|
||||
fi;
|
||||
|
||||
${command} "${service}"
|
Loading…
Add table
Add a link
Reference in a new issue