← Back to post

Edit history

Most recent

single line

here’s a single line for you which creates a one-shot service+timer in one go, suspending the system in 4 hours:

systemd-run --on-active=4h --unit=suspend-after-4h /usr/bin/systemctl suspend

If you want it to run repeatedly, simply replace –on-active with –on-calendar=“*-*-* 04:00:00” for example.

Original

single line

here’s a single line for you which creates a one-shot service+timer in one go, suspending the system in 4 hours:

systemd-run --on-active=4h --unit=poweroff-after-4h /usr/bin/systemctl suspend

If you want it to run repeatedly, simply replace –on-active with –on-calendar=“*-*-* 04:00:00” for example.