You are not logged in.

#1 2024-12-12 17:51:17

Feonik
Member
Registered: 2024-12-12
Posts: 1

Run script just before powerdown after hibernate using systemd

There is a similar topic using the pm-utils:
https://bbs.archlinux.org/viewtopic.php?id=78856

I use the nut (Network UPS Tools) and I need to give a command:

upscmd -u upsuser -p pass UPS shutdown.stayoff

after hibernation but before powering off.

I tried to use the experience from here:
https://wiki.archlinux.org/title/APC_UP … te_is_done

case $2 in
  hibernate)
    case $1 in
       pre)
            upscmd -u upsuser -p pass UPS shutdown.stayoff

But this command is executed before entering hibernation.

UPS turns off 10 seconds after the command, and it takes me 2-3 minutes to go into hibernation.

Please help me solve this problem. Thank you.

Offline

#2 2024-12-13 02:31:08

iith4ahm
Member
Registered: 2021-01-11
Posts: 53

Re: Run script just before powerdown after hibernate using systemd

Are either of these options useful?

  • write a script that you run to shut down your computer. In this script, first do whatever you're looking to do with your UPS, then at the end actually give the shutdown command

  • add a systemd service with an ExecStop like here

If neither of those work maybe someone else would find it helpful if you explain exactly what you're going for and mean by "after hibernation but before powering off" so they don't have to read the links

Also in case relevant:
https://wiki.archlinux.org/title/Power_ … leep_hooks

Offline

Board footer

Powered by FluxBB