Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # simple script to test invoking over ssh and cancelling with ctrl-c to trigger trap cleanup
- LOCKFILEPATH="/tmp/signaltest.lock"
- function mutex() {
- if [ -f "$LOCKFILEPATH" ]; then
- echo -e "Build already in progress! Exiting.";
- exit 1;
- else
- touch $LOCKFILEPATH;
- trap cleanup EXIT SIGHUP SIGKILL SIGTERM SIGINT;
- fi
- }
- function gitclone() {
- git clone --branch master [email protected]:bitcoin/bitcoin.git src_$(date +"%s");
- }
- function cleanup() {
- rm -rf "$LOCKFILEPATH";
- }
- mutex \
- && gitclone;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement