WIP: Determine the service name to use

This commit is contained in:
Jeremy Gardais 2019-10-17 16:15:47 +02:00
parent 5e66b3f93c
commit 379e29c5b7
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 13 additions and 1 deletions

View File

@ -19,7 +19,7 @@ DEBUG=0
# Tests {{{ # Tests {{{
# Expect at least 1 argument and 3 maximum {{{ ## Expect at least 1 argument and 3 maximum {{{
case $# in case $# in
1 ) 1 )
ct_name="${1}" ct_name="${1}"
@ -81,4 +81,16 @@ fi
# }}} # }}}
# Get container service name {{{
ct_service_name=$(find /etc/systemd -type f -iname "*${ct_name}*.service" -printf "%f\n")
## If no specific systemd service exists, the docker.service will be used
if [ "${ct_service_name}" = "" ]; then
ct_service_name="docker.service"
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Service name — No specific service found for ${ct_name} container, the ${ct_service_name} will be stopped."
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Service name — Service name of the container to backup: ${ct_service_name} ."
fi
# }}}
exit 0 exit 0