Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2010-07-13 09:36:34 +0000
committershtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2010-07-13 09:36:34 +0000
commitbf24c63578b4b6747fd497d05abf479cdc461634 (patch)
tree1cde1dfe860cfabff14b330bd79bccd42bc7e808 /openbsd
parent9a1c57ec8514b7d93c7c134e7f3b37063a5b3ce8 (diff)
[denyhost.sh] Add a check to avoid running several instances...
git-svn-id: svn+ssh://scm.narf.ssji.net/svn/shtrom/scripts@817 1991c358-8f32-0410-a49a-990740bdf4c2
Diffstat (limited to 'openbsd')
-rwxr-xr-xopenbsd/denyhost.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/openbsd/denyhost.sh b/openbsd/denyhost.sh
index 6f60e8d..e7f59d0 100755
--- a/openbsd/denyhost.sh
+++ b/openbsd/denyhost.sh
@@ -26,6 +26,11 @@ DEST_ADDR=root@distant-sun.narf.ssji.net
MAIL=mail
+# Exit if another instance is already running.
+# Selecting on 'R+' is a bit of a kludge to avoid getting yet to be named
+# processes forks for the pipe of this very check...
+ps ax | grep $0 | grep -v "R+" | grep -v $$ | grep -qv grep && exit 1
+
function process_ip
{
HOST_FILE=`mktemp ${TMP_DIR}/host.XXXXXX`