Skip to content

Instantly share code, notes, and snippets.

@fdv
Created August 30, 2017 15:24
Show Gist options
  • Save fdv/b3de9308649e10b498090f349a11c8be to your computer and use it in GitHub Desktop.
Save fdv/b3de9308649e10b498090f349a11c8be to your computer and use it in GitHub Desktop.
if [ -f "${LOCK_FILE}" ]; then
log_error "A backup is already running with pid $(cat ${LOCK_FILE})"
echo $$ > "${LOCK_FILE}"
if [ $? -gt 0 ]; then
log_error "Error: could not create lock file, exiting"
fi
fi
# do all the logic here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment