Skip to content
Snippets Groups Projects
Commit a26a830e authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add script to cleanup podman on a single cluster node

parents
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#
# This script removes unused resources for podman on cluster nodes in the bcf slurm cluster.
# It assumes that the podman run directory is located at /tmp/podman-run-${UID}. It will delete
# unused images, stopped containers, unused volumes and the podman run directory.
#
set -eo pipefail
PODMAN_DIR=/tmp/podman-run-${UID}
if [[ -e $PODMAN_DIR ]]
then
echo "Podman found on $(hostname)"
RUNNING_COUNT=$(podman ps --noheading | wc -l)
podman system prune -a -f
if [[ $RUNNING_COUNT -gt 0 ]]
then
echo "You still have ${RUNNING_COUNT} jobs running on $(hostname)"
else
rm -rf $PODMAN_DIR
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment