ctdb-scripts: Use more unique temporary file names
authorMartin Schwenke <martin@meltin.net>
Thu, 10 Dec 2015 04:03:46 +0000 (15:03 +1100)
committerMichael Adam <obnox@samba.org>
Tue, 12 Jan 2016 18:16:18 +0000 (19:16 +0100)
commita7ce00cc0392cbbc009e2dbe8d58258d6ba0566f
treecbd406ffaab59775dd07c9302be80c31df9b1828
parent4afe822397a0fe8f3e528077089577c89c9895e5
ctdb-scripts: Use more unique temporary file names

Consider this sequence of events:

1. Instance of script running update_tickles() hangs
2. Script debugging is launched asynchronously
3. New instance of script is launched, creates temporary file(s)
4. Original hung script makes progress before asynchronous script
   debugging kills it, so it removes temporary file(s)
5. New instance of script produces error due to missing files(s)

This is obviously rare.

Use more unique filenames to avoid step (4) removing the file(s)
belonging to other instances of the script.

This requires some extra cleanup to avoid too many temporary files
(which is why unique filenames were not originally usd).  It is
sufficient to remove files modified at least 10 minutes ago.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/config/functions