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
F82189996: D39965.id121519.diff
Fri, Apr 26, 7:41 AM
F82188103: D39965.id122309.diff
Fri, Apr 26, 7:06 AM
F82187961: D39965.id.diff
Fri, Apr 26, 7:06 AM
F82149767: D39965.diff
Thu, Apr 25, 11:35 PM
Unknown Object (File)
Mar 11 2024, 12:50 PM
Unknown Object (File)
Mar 11 2024, 12:45 PM
Unknown Object (File)
Mar 8 2024, 1:08 AM
Unknown Object (File)
Mar 8 2024, 12:58 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.