Changeset 2329 in /cluster/svnroot


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

Adding locking to snarfhosts (#495)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/branches/fitz-devel/trees/bin/bccd-snarfhosts

    r2293 r2329  
    1 #!/bin/bash 
     1#!/bin/bash
    22
    33C3CONF=/etc/c3.conf
     
    99else
    1010        FILE=$HOME/machines
     11fi
     12
     13if test -f $FILE.lock; then
     14        exit
     15else
     16        echo $$ > $FILE.lock
    1117fi
    1218
     
    2430        DIR=/tmp/bccd/
    2531        NODES=`find $DIR -mindepth 1 -maxdepth 1|grep -v \`hostname\`|sed -e "s!^$DIR!!g"`
    26         HEADNODE="`hostname`"
     32        NODES="`hostname` $NODES"
    2733elif test $STAGE = "LIBERATED"; then
    2834        DIR=/bccd/home/meta/nodes/
    2935        NODES=`find $DIR -type f -cmin -2 -exec basename {} \;|grep -v node000`
    30         HEADNODE="node000"
     36        NODES="node000 $NODES"
    3137fi
    32 NODES="$HEADNODE $NODES"
     38
     39# Verify lock file is ours before continuing
     40if test `head -1 $FILE.lock` -ne $$; then
     41        exit
     42fi
    3343
    3444for n in $NODES;do
     
    6575        echo "}" >> $C3CONF
    6676fi
     77
     78rm -f $FILE.lock
Note: See TracChangeset for help on using the changeset viewer.