From ce29daf744f35a22e4f0134765fa75c85f9d05a7 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 20 Apr 2022 22:33:34 +0200 Subject: [PATCH] helper/tmpdir-setup: Add cleanup command --- helper/tmpdir-setup | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/helper/tmpdir-setup b/helper/tmpdir-setup index c36b7dc9..2c168366 100755 --- a/helper/tmpdir-setup +++ b/helper/tmpdir-setup @@ -4,6 +4,7 @@ usage() { cat <&2 usage: $0 create JOBID SIZE UID # create SIZE GiB /dev/shm/mxqd/mnt/job/$JOBID + $0 cleanup JOBID # cleanup EOF exit 1 } @@ -47,6 +48,16 @@ cmd_create() { exit $status } +cmd_cleanup() { + (( $# == 1 )) || usage + MXQ_JOBID=$1 + + mountpoint=$mntdir/$MXQ_JOBID + + umount $mountpoint + rmdir $mountpoint +} + (( $# > 0 )) || usage cmd="$1" shift; @@ -54,6 +65,9 @@ case "$cmd" in create) cmd_create "$@" ;; + cleanup) + cmd_cleanup "$@" + ;; *) usage ;;