Changeset 2330 in /cluster/svnroot


Ignore:
Timestamp:
Apr 12, 2010 2:36:41 PM (11 years ago)
Author:
fitz
Message:

Adding locking to snarfhosts (#495)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/trunk/trees/bin/bccd-snarfhosts

    r2264 r2330  
    1 #!/bin/bash 
     1#!/bin/bash
    22
    33. /usr/local/Modules/3.2.6/init/bash
     
    77else
    88        FILE=$HOME/machines
     9fi
     10
     11if test -f $FILE.lock; then
     12        exit
     13else
     14        echo $$ > $FILE.lock
    915fi
    1016
     
    2026
    2127if test $STAGE = "LIVE"; then
    22         DIR=/tmp/bccd/
    23         NODES=`find $DIR -mindepth 1 -maxdepth 1|grep -v \`hostname\`|sed -e "s!^$DIR!!g"`
     28        DIR=/tmp/bccd/
     29        NODES=`find $DIR -mindepth 1 -maxdepth 1|grep -v \`hostname\`|sed -e "s!^$DIR!!g"`
    2430        NODES="`hostname` $NODES"
    2531elif test $STAGE = "LIBERATED"; then
    26         DIR=/bccd/home/meta/nodes/
    27         NODES=`find $DIR -type f -cmin -2 -exec basename {} \;|grep -v node000`
     32        DIR=/bccd/home/meta/nodes/
     33        NODES=`find $DIR -type f -cmin -2 -exec basename {} \;|grep -v node000`
    2834        NODES="node000 $NODES"
     35fi
     36
     37# Verify lock file is ours before continuing
     38if test `head -1 $FILE.lock` -ne $$; then
     39        exit
    2940fi
    3041
     
    5162        fi
    5263done
     64
     65rm -f $FILE.lock
Note: See TracChangeset for help on using the changeset viewer.