If I may be so bold as to make a tiny suggestion, I would like to change the way newnews.pl now brutally kills (kill -9) when a previous instance is running.
For other "new-news" utilities, I use the following code at the beginning of my prog,
open (NEWSLOCK, '>/tmp/new-news.lock') || exit 1;
exit 1 if (not (flock (NEWSLOCK, 6)));
That will try to acquire an exclusive lock, but leave when it cannot immediately do so. That way, when the previous instance has not finished yet, nothing needs to be brutally killed (jn whatever state of update it might be), and instead this ensures no new update begins until the last one ended.
- Mark
System Administrator Asarian-host.org
---
"If you were supposed to understand it,
we wouldn't call it code." - FedEx
|