WIP: Determine the service name to use
This commit is contained in:
parent
5e66b3f93c
commit
379e29c5b7
|
@ -19,7 +19,7 @@ DEBUG=0
|
|||
|
||||
# Tests {{{
|
||||
|
||||
# Expect at least 1 argument and 3 maximum {{{
|
||||
## Expect at least 1 argument and 3 maximum {{{
|
||||
case $# in
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue