On 12/04/2015 10:59 AM, Patrick O'Callaghan wrote:
On Fri, 2015-12-04 at 09:30 -0800, Rick Stevens wrote:
To make sure the lockfile gets deleted, you must create a function
that deletes the lockfile, and specify that function in a trap call
to trap SIGINT, SIGTERM, etc. That way it cleans up after itself if
you abort it.
For Shell scripts you can also trap on EXIT (a pseudo-signal that
triggers when the Shell is about to return normally).
Yup. "man bash" and search for the "trap" built-in to see those pseudo
signals (EXIT, DEBUG, ERR and RETURN).
However this isn't enough if the system crashes. For completeness you
also need code to clean up expired lock files e.g. on system reboot.
Yes. I was just using that shell script as an example of what lockfiles
are for and why there are crumbs left over on occasion.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 -
- -
- "I understand Windows 2000 has a Y2K problem." -
----------------------------------------------------------------------
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org