Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needrestart reports cron.service when it runs scripts that use file locking on itself #242

Open
moschlar opened this issue May 2, 2022 · 1 comment

Comments

@moschlar
Copy link

moschlar commented May 2, 2022

We have (at least) two Perl scripts that are run via Cron and they use File::NFSLock to get a lock on themselves:

use Fcntl qw(LOCK_EX LOCK_NB);
use File::NFSLock;

my $lock = File::NFSLock->new($0, LOCK_EX|LOCK_NB);

Apparently, this causes the files' own modification date to be set to the time of the lock creation (in addition to creating a $0.NFSLock file) which leads to needrestart reporting it:

[Core] #46608 is a NeedRestart::Interp::Perl
[Perl] #46608: source=/usr/local/adsm/adsm-check-nasbackups
[Core] #46608 uses obsolete script file(s):
[Core] #46608  /usr/local/adsm/adsm-check-nasbackups
[main] #46608 is a child of #46605
[main] #46605 exe => /bin/bash
[main] #46605 is cron.service

I don't know if there is the possibility for a general solution here (I can of course blacklist these scripts explicitly, but maybe there is a way to easily detect the situation).

@liske
Copy link
Owner

liske commented May 17, 2022

I don't see a generic way how to detect and handle this (and I would not expect any locking in /usr at all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants