[MacPorts] #6258: ENHANCEMENT: IndexRegen.sh should keep itself from running multiple instances

MacPorts noreply at macports.org
Thu Mar 24 08:31:15 PDT 2016


#6258: ENHANCEMENT: IndexRegen.sh should keep itself from running multiple
instances
----------------------+--------------------
  Reporter:  dluke@…  |      Owner:  jmpp@…
      Type:  defect   |     Status:  closed
  Priority:  Normal   |  Milestone:
 Component:  base     |    Version:  1.0
Resolution:  fixed    |   Keywords:
      Port:           |
----------------------+--------------------
Description changed by ryandesign@…:

Old 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

New 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
 }}}

--

-- 
Ticket URL: <https://trac.macports.org/ticket/6258#comment:6>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list