Shutdown RL9 only takes 1-2 seconds without waiting for all service to close?

I am using OpenPBS inside RL9, the pbs service should be stoped while reboot the system. However, the entire shutdown process took 1-2 seconds to complete, without waiting at all for the service to shut down properly. One should know that stoping pbs.service will takes more than 10 seconds in normal running system.

So is there a way to make rocky wait for all services to shut down properly when it reboots or shutdown?

Finally, it’s solved.

I had been trying to “add a systemd service to run before shutdown” for hours , but it never worked.

I finally solved it by adding a script to the /usr/lib/systemd/system-shutdown directory. The script here does run before shutdown.
such as add a executable file /usr/lib/systemd/system-shutdown/mystop.shutdown

#!/usr/bin/sh
# We need to ensure stop service or other jobs to finish
# before the shutdown.


/usr/bin/systemctl stop pbs.service

/usr/bin/sleep 10

2 Likes

Interesting (but logical) is that there is no /etc/… directory for site customizations, like for regular units.


The (regular) libvirt-guests.service is able to suspend running virtual guests. Not sure whether it succeeds within 2 seconds (I don’t auto-suspend guests), or can it actually postpone the inevitable.

There might be something wrong with the service.

When you shutdown, systemd services should stop; you can check persistent journal from previous boot with ‘-b 1’, and at the end it should show lots of services being stopped.