Page MenuHomeFreeBSD

rc.suspend: execute rc-scripts with suspend keyword
ClosedPublic

Authored by jo_bruelltuete.com on May 4 2023, 6:02 PM.
Tags
None
Referenced Files
F102596170: D39965.id122309.diff
Thu, Nov 14, 1:57 PM
F102551135: D39965.diff
Wed, Nov 13, 10:56 PM
Unknown Object (File)
Sep 18 2024, 6:46 PM
Unknown Object (File)
Sep 16 2024, 10:47 AM
Unknown Object (File)
Sep 15 2024, 11:34 PM
Unknown Object (File)
Aug 23 2024, 9:04 AM
Unknown Object (File)
Aug 23 2024, 9:03 AM
Unknown Object (File)
Aug 23 2024, 9:03 AM

Details

Summary

For symmetry with rc.resume, give rc.suspend the ability to execute rc-scripts.
Use the suspend keyword for that.

Use-case is for setting a wake-up time, e.g. via efiwake.

Test Plan

I've tried this on my NAS box, works as intended:

Dummy test script /etc/rc.d/try_resume:

#!/bin/sh -

# KEYWORD: resume
# KEYWORD: suspend
# REQUIRE: jail

logger "try resume: ${1}"

Press the sleep button, optionally wait a minute or so, press wake button:
/var/log/messages

May  4 18:54:46 fred root[53062]: try resume: suspend
May  4 18:54:46 fred acpi[53067]: suspend at 20230504 18:54:46
...noise...
May  4 18:57:53 fred acpi[53080]: resumed at 20230504 18:57:53
...noise...
May  4 18:58:09 fred root[53159]: try resume: resume

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

i've pretty much copy-pasted the added bits from rc.resume and adjusted the keyword. that's it.

christos added a subscriber: christos.

It'd better to rename the commit title to: rc.suspend: execute rc-scripts with suspend keyword, otherwise LGTM.

This revision is now accepted and ready to land.May 4 2023, 6:18 PM
jo_bruelltuete.com retitled this revision from rc.suspend can execute rc-scripts with suspend keyword to rc.suspend: execute rc-scripts with suspend keyword.May 4 2023, 6:22 PM

thanks for looking!

markj added a subscriber: markj.

Seems ok to me. Looks like rc.suspend should be documented to some extent in rc.8, if anyone would like to take that on. rc.resume is at least mentioned there.

Approved.

libexec/rc/rc.suspend
45–46

Unrelated, but I think we can safely delete this comment. :)

Looks like rc.suspend should be documented to some extent in rc.8, if anyone would like to take that on. rc.resume is at least mentioned there.

See D40484.