From: Alexander Schmidt Date: Tue, 10 Jun 2014 14:53:41 +0000 (+0200) Subject: Exit if another instance is already running X-Git-Url: https://git.treefish.org/~alex/backmeupscotty.git/commitdiff_plain/3de5101a6a0f9fac2b421ae66923cbc389d8f771 Exit if another instance is already running --- diff --git a/backmeupscotty b/backmeupscotty index d1500c1..0af4cd5 100644 --- a/backmeupscotty +++ b/backmeupscotty @@ -5,6 +5,11 @@ REMOTE_BASE=/tmp/backmeupscotty ARCHIVE_KEEPNBACKUPS=30 ARCHIVE_KEEPNDAYS=30 +if [ $(pidof -x $(basename $0) | wc -w) -gt 2 ]; then + echo BACKMEUPSCOTTY: Another instance of $(basename $0) is already running! >&2 + exit 1 +fi + while getopts ":q" opt; do case $opt in q)