Skip to content

Commit

Permalink
helper/tmpdir-setup: Add cleanup command
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Apr 20, 2022
1 parent 08b5694 commit ce29daf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions helper/tmpdir-setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ usage() {
cat <<EOF >&2
usage:
$0 create JOBID SIZE UID # create SIZE GiB /dev/shm/mxqd/mnt/job/$JOBID
$0 cleanup JOBID # cleanup
EOF
exit 1
}
Expand Down Expand Up @@ -47,13 +48,26 @@ cmd_create() {
exit $status
}

cmd_cleanup() {
(( $# == 1 )) || usage
MXQ_JOBID=$1

mountpoint=$mntdir/$MXQ_JOBID

umount $mountpoint
rmdir $mountpoint
}

(( $# > 0 )) || usage
cmd="$1"
shift;
case "$cmd" in
create)
cmd_create "$@"
;;
cleanup)
cmd_cleanup "$@"
;;
*)
usage
;;
Expand Down

0 comments on commit ce29daf

Please sign in to comment.