Posts Tagged zenity
Time Up Dude Ver2
Additional Features form old version
## Snooze for 10mins
## Starts triggering only if HDD temperature above 40 degrees
## Pops when temp is above 49 degrees wateva the time it isĀ
## Additional package needed from previous version : hddtemp
## Resets the counter to 60 when system goes idle for 5 mins
sudo apt-get install hddtemp
The new code is (more…)
1 comment September 23, 2008
Time Up Dude ver1.01
Necessity is the mother of all inventions. Yes that is true. And for inventions to take place there should be a motivator.
I had very bad HDD crashes recently and i think the problem is the extreme use of my system which is on almost for 22 hrs a day on holidays and 14hrs on weekdays.
So i decided to make a tool to notify me when it is 1hr of use and give me options to shutdown and continue using.
This was the first thing i did after installing an OS on the replaced HDD this time. My of the insipriation for trying it out is my senior at college srijith.
He also has a similar tool but more better.
So here goes the stuff.
my username is cyriac
and i belong to a group script on my system.
Basic things to do prior to working my script.
edit the sudoers file.
log in as root
visudo
add the line
%script ALL=NOPASSWD: ALL
note that i belong to the group script
now create a folders in the home directory with names /logs and /logs/timeupdude
mkdir ~/logs/timeupdude -p
make a textfile with name timeupdude
and paste the code below.
work=TRUE
echo "60" > /home/cyriac/logs/timeupdude/testf
while [ $work = TRUE ]
do
tt=`cat /home/cyriac/logs/timeupdude/testf`
if [ $tt -eq 0 ]
then
ans=`zenity - -title "TIME UP DUDE" - -text "YOUR UPTIME IS OVER AN HOUR NOW " - -list - -radiolist - -column "SELECTION" - -column "ACTION" False SHUTDOWN True CONTINUE_WORKING`
if [ $ans = CONTINUE ]
then
echo "60" > /home/cyriac/logs/timeupdude/testf
else
sudo shutdown -ah now
fi
else
sleep 60
tt=`expr $tt - 1`
echo $tt> /home/cyriac/logs/timeupdude/testf
fi
done
Save the file and make it excec by
chmod +x timeupdude
copy the file to /etc/init.d
and add it to the boot up
update-rc.d timeupdude defaults
Now restart the computer and the timeupdude is on the run..
The tool first shows the screen below when it is 1hr.
If SHUTDOWN is pressed the system shuts down else if CONTINUE_WORKING is pressed you can continue working until this window again pops up in 30mins
You can also edit the time by scannin my script.
And this script works with Gnome machines only.
Please note that the options in the zenity needs to be – - ie minusminus. not –
Will come up with a new version with the ideas my `guru`;) suggested..
Please leave comments so that i can find mistakes i made and improve..
2 comments September 21, 2008



