In X I've used the following script (from here) to lock the computer with i3lock each time
pm-hibernate are invoked.
#!/bin/sh # 00screensaver-lock: lock workstation on hibernate or suspend username=andreas userhome=/home/$username export XAUTHORITY="$userhome/.Xauthority" export DISPLAY=":0" case "$1" in hibernate|suspend) su $username -c "/usr/bin/i3lock & ;; thaw|resume) ;; *) exit $NA ;; esac
Now I'm in the process of setting up a console-only laptop (a minimal Debian install without the X server installed.)
I've tried using the above script on that machine to lock my session using vlock. (That is: I've switched out
vlock in the version of the script I'm using on the console machine.) I've also tried commenting out the two lines starting with
export XAUTHORITY and
export DISPLAY=":0" as they are X specific.
The script doesn't work on the no-X machine.
How should I call vlock each time the computer suspends/hibernates?