On 11/02/2024 11:21, Rainer Dorsch wrote:
Hello,

I saw during a reboot

        [  *** ] Job anacron.service/stop running (15min 49s / no limit)

eventually I did a hard reset, since I was not sure if the system simply hang.

I have two quick questions:
- How can I found out which process anacron is still running?

I think that, once the shutdown has started this is basically impossible. User sessions have likely been killed off so your only option would be to log in as root, but you'll probably also find that getty has been killed off too, so I don't know how you'd be able to enter any commands at this point.

However, one thing that you could look at is to inspect the journal from that boot. You can run "journalctl --list-boots" to get a list of boot ids, then run "journalctl -b <BOOT_ID> -u anacron". Anacron will print lines like the following:

Feb 10 13:32:50 host.example.com systemd[1]: Started anacron.service - Run anacron jobs. Feb 10 13:32:50 host.example.com anacron[1822]: Anacron 2.3 started on 2024-02-10 Feb 10 13:32:50 host.example.com anacron[1822]: Will run job `cron.daily' in 5 min. Feb 10 13:32:50 host.example.com anacron[1822]: Jobs will be executed sequentially
Feb 10 13:37:50 host.example.com anacron[1822]: Job `cron.daily' started
Feb 10 13:37:50 host.example.com anacron[38129]: Updated timestamp for job `cron.daily' to 2024-02-10 Feb 10 13:37:51 host.example.com anacron[1822]: Job `cron.daily' terminated (mailing output)
Feb 10 13:37:51 host.example.com anacron[1822]: Normal exit (1 job run)
Feb 10 13:37:51 host.example.com systemd[1]: anacron.service: Deactivated successfully.

So, from that, you can see which set of cron scripts were running. If you have multiple scripts, then yes, it's harder to tell which script was the long running one (perhaps it's something like locate updating it's database?)

- How do I set a timeout/limit for anacron, that it cannot block forever
during a reboot?

It may be germane to point out that anacron.service already explicitly sets "TimeoutStopSec=Infinity". So, in the opinion of the developers, the service shouldn't be prematurely killed. Of course you, as the system administrator, always have the right to countermand that sort of decision, but it would be curious to find out why the developers thought they needed to override the systemd default in the first place?



Thanks
Rainer

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to