Created
January 22, 2018 10:44
-
-
Save PaulChana/941a8330751d7529280ab48920365f82 to your computer and use it in GitHub Desktop.
[Bash Traps] Trap signals in bash #shell #bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/sh | |
function cleanup() { | |
rm -rf "${BUILD_DIR}" | |
rm -f "${LOCK_FILE}" | |
# get rid of /tmp detritus, leaving anything accessed 2 days ago+ | |
find "${BUILD_DIR_BASE}"/* -type d -atime +1 | rm -rf | |
echo "cleanup done" | |
} | |
trap cleanup TERM INT QUIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment