JJB wrote:
>I have perl script that issues the newsyslog command followed by 3
>perl scripts that process the new .0 rotated file.
>
>Problem is the newsyslog rotate has not completed creating the new
>.0 and rolling through the other .x files before the first perl
>script in trying to open the .0 file for processing.
>
>Is there in perl pause or wait command I can use to  allow some time
>to elapse before continuing with the launch of the next script?

Using a statement that delays for a specified period of time is a
generally bad idea because you can't guarantee that the operation will
complete in that time. Hence, you should look into filesystem locking
functions: 'perldoc -f fcntl', 'perldoc -f flock', and 'perldoc -f
lock'.

Alternatively, you could use the four-argument form of select to
receive information about when the files are available, but that's
probably too complicated for what you want to do.

Reading through 'perldoc perlipc' is advised for what you want to do.
Granted, it's not traditional IPC, but architecting some IPC would help
to guarantee that you're not processing the files before they're ready.

Yet _another_ possible solution: why do you have four scripts? Can you
not do what you want with one well-structured script? Perl has
virtually all of the branching constructs of C, and some of its very
own.

-- 
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated".  -- Ken Thompson
-
Unix is user friendly. However, it isn't idiot friendly.
-
Please CC me in all replies, even if I'm on the relevant list(s).

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to