gpu_server_setup/setup_suspend.sh

43 lines
851 B
Bash
Raw Permalink Normal View History

#!/bin/bash
echo "Not working yet"
exit
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get update && \
apt-get install -y hibernate uswsusp
SWAPFILE="/swap.img"
#UUID=$(findmnt -no UUID -T $SWAPFILE) <-- wrong?
swaplabel $SWAPFILE
OFFSET=$(swap-offset $SWAPFILE) #<---------- remove "resume offset ="
if [ $? -eq 0 ]; then
#change swapfile size
swapoff -a && \
dd if=/dev/zero of=$SWAPFILE bs=1G count=32 && \
mkswap $SWAPFILE && \
swapon $SWAPFILE
#show info
grep SwapTotal /proc/meminfo
fi
#modify /etc/default/grub:
#GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=c081f414-93bf-4f07-8b28-97f8acd3b052 resume_offset=10555392"
echo "RESUME=UUID=$UUID resume_offset=$OFFSET" > /etc/initramfs-tools/conf.d/resume
#Apply settings:
update-grub
update-initramfs -u -k all
#test with: sudo hibernate