Is there a way to determine if a SAMBA share has open files?
Solution 1:
If your samba server is configured to use file locking which is probably is, I suppose you could use 'smbstatus -L' to list the locks and then grep the output for the type of lock you're looking for (EXCLUSIVE, BATCH) if you knew you only cared about certain kinds of locks.
Something like:
smbstatus -L | grep EXCLUSIVE
and then test against the return value ($?) in the cron job script.
Unfortunately, I don't know enough about the types of locks to know if this is a suitable catch-all method or not.
Solution 2:
I would probably use the lsof command to determine what files are in use on the share.
lsof | grep /path/to/share
should show files in use.