Apologies if this is a trivial question, but I'm just starting out with scripts and not too sure what I'm doing
I have a sequence of scripts, the first, called "checker.sh" is very small and light-weight and runs under cron, and simply either finds a file in a predefined location and kicks off another script, or if no file is present, exits and waits for cron to come round again.
The second script, "mover.sh" moves the file from the original location to a transit directory, calls an Expect script to sftp it to another system, then on completion of the sftp, moves the file to a third directory to show it has actually been sftp-ed.
I would like to check the lock status of the file in the first directory, so the second script doesn't try to move a half-copied file. I also want to check the lock status of the file as it enters the transit directory, so I can be sure it has moved across completely before I try to kick of sftp. There are other areas where I may need to not only check the status, but also lock and unlock files to ensure completeness and integrity.
Are there any good tutorials out there, or do any of you have useful and documented script snippets that I could use...
Thanks!