1

I want to run a particular script that essentially does power management like suspend/poweroff at specific times daily on Arch Linux.

I tried this via fcron. No issues so far.

The problem is that I don't want the job to run next day on wakeup which it will if I had suspended the machine myself.

Any way out? Would any other scheduler do it better?

1
  • Make part of your "I suspend it myself" procedure setting a flag file, e.g. touch /var/run/myscript.flag, and modify the power management script check for /var/run/myscript.flag, and Do the Right Thing.
    – waltinator
    Jun 11 '21 at 19:54
0

Timers are what you want!

systemctl list-timers

lists the currently active timers. Arch actually has a nice article on them; you might want to scroll down to the point where they demonstrate transient timer units:

systemd-run --on-active="12h 30m" /bin/touch /tmp/foo

touches the file /tmp/foo after twelve and half an hour of activity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.