Create /etc/pm/sleep.d/05_ssh_keepawake file
$ sudo vim /etc/pm/sleep.d/05_ssh_keepawake
Copy the following content to the file
#!/bin/sh
#check for SSH sessions, and prevent suspending:
if [ `who | grep -cv "(:"` -gt 0 ]; then
echo "SSH session(s) are on. Not suspending."
exit 1;
fi
Make it executable
$ sudo chmod +x /etc/pm/sleep.d/05_ssh_keepawake
Make sure to reboot your system to take effect!
No comments:
Post a Comment