First steps to inspect

This commit is contained in:
LinuxSquare 2023-12-23 13:52:01 +01:00
parent d97fe62301
commit f553eb9767
2 changed files with 11 additions and 2 deletions

4
poddoc
View file

@ -41,8 +41,8 @@ the terms of the ${LICENSE}"
# SCRIPT START
##
OPT_SHORT="hVvnp:s:x:"
OPT_LONG="help,version,verbose,dryrun,noconfirm,pull:,start:,stop:"
OPT_SHORT="hVvnp:s:x:i:"
OPT_LONG="help,version,verbose,dryrun,noconfirm,pull:,start:,stop:,inspect:"
TEMP=$(getopt -o ${OPT_SHORT} --long ${OPT_LONG} -n $(basename ${0}) -- "$@")
if [ "$?" != 0 ]; then

View file

@ -23,6 +23,11 @@ function inspectpod() {
log e "Podman-directory of ${1} does not exist!"
exit 1
fi
echo -ne "Container-Name: $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name)
Network: $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} network.name)
Status:$([[ -n $(podman container ls | grep $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name)) ]] && ${GREEN} Running ${RESET} || ${RED} Stopped ${RESET})
Uptime: ${GREEN}$(podman container ls | grep ${1} | awk '{$1=$1};1' | cut -d' ' -f 7-8)${RESET}"
}
##
@ -53,6 +58,10 @@ function startpod() {
podman-compose up -d
}
##
# 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!"