Deleting a file/directory on startup

Jonathan Underwood jonathan.underwood at gmail.com
Fri Jan 11 18:41:21 UTC 2008


On 11/01/2008, Till Maas <opensource at till.name> wrote:
> Hiyas,
>
> a package I comaintain (pm-utils) uses a lockfile. Because it may happen that
> the computer crashes when the program is used, the lockfile may be there
> already when no instance of pm-utils is running. Therefore the lockfile
> should be deleted on startup. Do I need to write an initscript for this?
> Which is imho not 100% correct, because this "service" should never be
> deactivated. Is there a directory , where one could drop a file for this? The
> only one I can think of would be /etc/sysconfig/modules, where ever .modules
> file is executed at startup. The original feature request to split up
> rc.sysinit in a rc.sysinit.d structure is more than five years old (which
> would be a good solution here), so I doubt that filing a feature request will
> help here. But maybe someone knows a better solution that the two I can think
> of.

Have a look at the logic used in the fail2ban init file - the start
operation checks for a running fail2ban process. If non is found, it
is safe to delete the lock file.

As it happens, I just noticed that dovecot doesn't properly handle
this situation either.




More information about the fedora-devel-list mailing list