Skip to content

Commit 2cf8ef5

Browse files
bruelltuetechristosmarg
authored andcommitted
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
1 parent 98ab980 commit 2cf8ef5

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

libexec/rc/rc.suspend

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,28 @@ fi
4343

4444
echo $$ 2> /dev/null > /var/run/rc.suspend.pid
4545

46-
# If you have troubles on suspending with PC-CARD modem, try this.
47-
# See also contrib/pccardq.c (Only for PAO users).
48-
# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /uart/ \
49-
# { printf("pccardc power %d 0", $1); }' | sh
50-
5146
# If a device driver has problems suspending, try unloading it before
5247
# suspend and reloading it on resume. Example:
5348
# kldunload usb
5449

50+
. /etc/rc.subr
51+
52+
load_rc_config
53+
54+
rcorder_opts="-k suspend"
55+
56+
case ${local_startup} in
57+
[Nn][Oo] | '') ;;
58+
*) find_local_scripts_new ;;
59+
esac
60+
61+
files=`rcorder ${rcorder_opts} /etc/rc.d/* ${local_rc} 2>/dev/null`
62+
63+
for _rc_elem in $files; do
64+
debug "run_rc_script $_rc_elem suspend"
65+
run_rc_script $_rc_elem suspend
66+
done
67+
5568
/usr/bin/logger -t $subsystem suspend at `/bin/date +'%Y%m%d %H:%M:%S'`
5669
/bin/sync && /bin/sync && /bin/sync
5770
/bin/sleep 3

0 commit comments

Comments
 (0)