20 lines
606 B
Bash
20 lines
606 B
Bash
#!/usr/bin/env bash
|
|
|
|
##
|
|
# description: stops and deletes the specified podman container
|
|
# usage: stoppod <pod-name>
|
|
##
|
|
function stoppod() {
|
|
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
|
|
log e "Podman-directory of ${1} does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z $(podman container ls | grep $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name)) ]]; then
|
|
log e "Container $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name) does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
|
|
podman-compose down
|
|
}
|