Opened 18 years ago

Last modified 8 years ago

#6258 closed defect

ENHANCEMENT: IndexRegen.sh should keep itself from running multiple instances — at Initial Version

Reported by: danielluke (Daniel J. Luke) Owned by: darwinports-bugs@…
Priority: Normal Milestone:
Component: base Version: 1.0
Keywords: Cc:
Port:

Description

In times like now, when the darwinports cvs server is wonky, we don't want (or at least _I_ don't want) a bunch of IndexRegen script executions queued up.

A simple way of doing this is to have the script create and remove a lockfile. It's not perfect (as there's a potential race condition), but works as long as the script is executed in the normal fashion (run out of cron twice a day or so).

Anyway, here's the diff:

--- IndexRegen.sh 2005-12-06 15:47:42.000000000 -0500 +++ /Users/dluke/Applications/IndexRegen.sh 2005-12-11 14:10:49.000000000 -0500 @@ -9,18 +9,19 @@

####

# Configuration

+LOCKFILE=/tmp/.dp_index_regen.lock

# ROOT directory, where everything is. This must exist.

@@ -47,6 +48,13 @@

# The date. DATE=$(date +'%A %Y-%m-%d at %H:%M:%S')

+if [ ! -e $LOCKFILE ]; then + touch $LOCKFILE +else + echo "Index Regen lockfile found, is another index regen running?" + exit 1 +fi +

# Create the SSH wrapper if it doesn't exist (comment this for -d /Volumes...) if [ ! -e $SSH_KEY ]; then

echo "Key doesn't exist. The script is configured to find the SSH key at:"

@@ -140,3 +148,4 @@

rm -f $COMMIT_MSG $FAILURE_LOG

fi

+rm -f $LOCKFILE

Change History (0)

Note: See TracTickets for help on using tickets.