I am about to create an update system for a database that uses a CSV file to update/insert rows in postgresql database's tables.
I was thinking of a crontab entry that scans the FS for a newer upload than it's last execution time (about every minute). If a file is present it launches the update script. The problem I see coming is 'What if the upload isn't terminated yet?'
Well, in our case here it wouldn't be that bad, since only valid cvs lines will go for the update that itselfs happens in a transaction.
But is there a way to verify that no file descriptor is open the file before proceeding with the update? or any other solution, hint, idea is welcome...
Otherwise I'll go for a #!/bin/bash with lsof on the file...
Thread safe file system access
Moderator: General Moderators
- greenhorn666
- Forum Commoner
- Posts: 87
- Joined: Thu Aug 14, 2003 7:14 am
- Location: Brussels, Belgium
- greenhorn666
- Forum Commoner
- Posts: 87
- Joined: Thu Aug 14, 2003 7:14 am
- Location: Brussels, Belgium