diff options
author | Johannes Totz <jo@bruelltuete.com> | 2023-05-23 15:11:31 +0000 |
---|---|---|
committer | Christos Margiolis <christos@FreeBSD.org> | 2023-05-23 15:11:31 +0000 |
commit | 2cf8ef5910fd3754f8021f9c67fde6b9d9030f33 (patch) | |
tree | 048c7339baa84729551f46b3a9ccd6c03d27255a | |
parent | 98ab9802affed1bf7c2009569eac468c86c159e8 (diff) | |
download | src-2cf8ef5910fd3754f8021f9c67fde6b9d9030f33.tar.gz src-2cf8ef5910fd3754f8021f9c67fde6b9d9030f33.zip |
rc.suspend: execute rc-scripts with suspend keyword
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.
Reviewed by: christos
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D39965
-rwxr-xr-x | libexec/rc/rc.suspend | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libexec/rc/rc.suspend b/libexec/rc/rc.suspend index 5f22cd1a05b1..41b5bcbf897b 100755 --- a/libexec/rc/rc.suspend +++ b/libexec/rc/rc.suspend @@ -43,15 +43,28 @@ fi echo $$ 2> /dev/null > /var/run/rc.suspend.pid -# If you have troubles on suspending with PC-CARD modem, try this. -# See also contrib/pccardq.c (Only for PAO users). -# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /uart/ \ -# { printf("pccardc power %d 0", $1); }' | sh - # If a device driver has problems suspending, try unloading it before # suspend and reloading it on resume. Example: # kldunload usb +. /etc/rc.subr + +load_rc_config + +rcorder_opts="-k suspend" + +case ${local_startup} in +[Nn][Oo] | '') ;; +*) find_local_scripts_new ;; +esac + +files=`rcorder ${rcorder_opts} /etc/rc.d/* ${local_rc} 2>/dev/null` + +for _rc_elem in $files; do + debug "run_rc_script $_rc_elem suspend" + run_rc_script $_rc_elem suspend +done + /usr/bin/logger -t $subsystem suspend at `/bin/date +'%Y%m%d %H:%M:%S'` /bin/sync && /bin/sync && /bin/sync /bin/sleep 3 |