]> git.treefish.org Git - backmeupscotty.git/commitdiff
Exit if another instance is already running
authorAlexander Schmidt <alex@treefish.org>
Tue, 10 Jun 2014 14:53:41 +0000 (16:53 +0200)
committerAlexander Schmidt <alex@treefish.org>
Tue, 10 Jun 2014 14:53:41 +0000 (16:53 +0200)
backmeupscotty

index d1500c1c3d15d7bce4384d9fbd23e033a2cc2f5c..0af4cd5927c371d515f45d36c9241945e6d2bbfd 100644 (file)
@@ -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)