On Thu, 2006-03-30 at 13:47, Charles Steinkuehler wrote:
> Mike Noyes wrote:
<snip>
> NOTE:  A cvs lock is *NOT* a lockfile.  It is a lock placed on file(s)
> in the CVS repository by a that can only be removed by someone with full
> access to the CVS repository (ie: SF Staff).

Charles,
Thanks for clarifying that. It makes more sense now.

BTW, thanks for walking me through this stuff, and answering my ignorant
questions. I appreciate it.

> A lockfile as used by your shell script is just a normal file in our SF
>  project space, removable by anyone with rights to delete the file
>  (should at least be any project admins, and could safely be any
>  project developer, IMHO).  Normal *nix file permission rules apply,
>  and no SF staff intervention is required if something goes wrong.

Ok. If I place the doc-build.sh script in our project shell space (say
in /home/groups/l/le/leaf/admin/), where will the lockfile be created
when run from cron? My home directory, or the location of the shell
script (leaf/admin/)? From your description above, I gather it gets
created in the shell script location unless otherwise specified.

<snip>
> > Would 'trap', as shown in the link below, achieve the results I was
> > looking for originally?
> > 
> >         Writing Robust Bash Shell Scripts: Setting traps
> >         
> > http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
> 
> Yes, using the exit trap would be a good way to clear the lockfile if
> something unexpected happens.  The example trap commands they provide
> look good to me.  Note instead of using bash to test for and create the
> lockfile, the lockfile command does both, so you could do:
> 
> if lockfile -l 72000 "$LOCKFILE" ; then
>   trap ...
>   critical-section
>   ...
> 
> (ie: no 'touch' to create the lockfile, and no file exists check in the
> if statement).
> 
> > BTW, I'm not using 'set -e' either.
> 
> You could add this, if you want, might be a good idea.  You'd have to
> change the places you're checking return codes:
> 
> from:
>   lockfile -r 0 -l 72000 $LOCKFILE
>   check_errors $? "Lockfile creation failed."
> 
> to:
>   lockfile -r 0 -l 72000 $LOCKFILE || \
>     check_errors $? "Lockfile creation failed."
> 
> Note that now the check_errors only gets called if there is actually an
> error (due to the ||) instead of all the time.

Thanks for the tips. I'll attempt to place them in doc-build.sh when cvs
access is restored.

        Note: CVS is off-line at this time. See SF Site Status

-- 
Mike Noyes <mhnoyes at users.sourceforge.net>
http://sourceforge.net/users/mhnoyes/
SF.net Projects: leaf, phpwebsite, phpwebsite-comm, sitedocs



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

_______________________________________________
leaf-devel mailing list
leaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to