-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgnome-programmed-shutdown.sh
More file actions
26 lines (23 loc) · 933 Bytes
/
Copy pathgnome-programmed-shutdown.sh
File metadata and controls
26 lines (23 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# gnome-programmed-shutdown.sh - A script that shutdown the computer after some time
# asked in minutes using a graphical dialog and progress bar
# Author: Diego Toharia - diego@toharia.com
# Screenshots: http://blog.deigote.com/2009/04/17/programmed-shutdown-pequeno-script-para-apagar-la-maquina/
# Dependencies:
# * zenity (modern gdialog replacement)
# Messages
TITLE="Shutdown the computer"
MINUTES_QUESTION="How much minutes should I wait?"
WAIT_PRE="Waiting"
WAIT_POST="minutes"
minutes=`zenity --entry --title "$TITLE" --text "$MINUTES_QUESTION" 2>&1` || exit
seconds=`expr $minutes "*" 60`
if [ $seconds != "" ] ; then
for i in `seq 1 $seconds` ; do
percentage=`expr $i "*" 100`
percentage=`expr $percentage "/" $seconds`
echo $percentage
sleep 1
done | zenity --title="$TITLE" --text="$WAIT_PRE $minutes $WAIT_POST" --progress --auto-close --auto-kill
poweroff
fi