[CentOS] Any one have a good example...

Johnny Hughes mailing-lists at hughesjr.com
Tue Aug 29 20:02:12 UTC 2006


On Tue, 2006-08-29 at 15:59 -0400, mike.redan at bell.ca wrote:
> Maybe I am being dense here ... BUT ...
> 
> Doesn't the "echo $$" only happen AFTER the else process is finished ???
> 
> if you make the "else" process be the rsync script, then it will not
> create $pidfile until after the rsync is done ... which does not help
> you.
> 
> if you leave the else process as is and kick off the rsync after the
> echo $$ then it is not the same PID that you wrote to the $pidfile and
> you will start more than one rsync process ... as the PID that you wrote
> to $pidfile as the echo process ... that already finished ... or I am
> mistaken?
> 
> 
> The idea of it is to place that bit of code at or near the beginning of
> your script, then have the rsync process start after the "echo $$". That
> will put the PID of your script into that file, the rsync process will
> be started in the script, and the script would not end until the rsync
> one does..so you are fairly safe that two instances of your script will
> run at thte same time..
> 

OK ... I see.

The rsync process is a second PID ... but the first PID is also still
open until after the script closes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.centos.org/pipermail/centos/attachments/20060829/e29695fb/attachment.sig>


More information about the CentOS mailing list