| Server IP : 104.21.21.239 / Your IP : 216.73.217.123 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/systemd/system-sleep/ |
Upload File : |
#!/usr/bin/bash
# Runs on resume from hibernation via the systemd system-sleep hook:
# $1=post $2=hibernate
#
# Records the resume time so acpid.sleep.sh's should_hibernate() can debounce a
# spurious sleep-button event that arrives shortly after a resume.
#
# We intentionally do NOT swapoff /swap here. After a successful resume the
# kernel has already invalidated the hibernation image (the swap signature is
# reset during resume), so the swap area is just ordinary swap again and does
# not need tearing down. swapoff would have to page the entire image back into
# RAM synchronously; on a memory-heavy host that cannot fit, swapoff blocks in
# uninterruptible (D) state and freezes the instance.
HIBERNATE_STATE_DIR=/var/run/hibernate
RESUMED_AT="$HIBERNATE_STATE_DIR/resumed_at"
LOGNAME="hibernate"
log() {
logger -t "$LOGNAME" "[PID $$] $1"
}
if [ "$1" = "post" ] && [ "$2" = "hibernate" ]; then
resumed_time=$(date +%s)
mkdir -p "$HIBERNATE_STATE_DIR"
echo "$resumed_time" > "$RESUMED_AT"
log "Resumed at $resumed_time (wrote $RESUMED_AT)"
fi