Adding script to wait for some minutes and suspend system

This commit is contained in:
Bruno F. Fontes 2018-12-13 11:03:44 -02:00
parent 5d37b4e886
commit f505d3bed1
Signed by: brunofontes
GPG Key ID: EE3447CE80048495

15
waitAndSleep.sh Executable file
View File

@ -0,0 +1,15 @@
if [ -z $1 ]; then
echo "Define how many minutes to wait before sleep"
echo
echo "Example: to wait 5 minutes before system suspend, run the following code:"
echo "waitAndSleep.sh 5"
echo
exit
fi
echo "Type your password: "
read -s sudoPass
echo
minutes=$(($1 * 60))
echo "System will sleep in $minutes minutes"
sleep "$minutes" && echo -e "$sudoPass\n" | sudo -S systemctl suspend