I think I found this tip at Lifehacker at some point and decided to implement it. The idea is simple – you set up a script that will ask you what you are currently doing every hour or so, and collect the information in a text file. Then you can parse the file later to see how much time you spend on a given task, or how many things have you accomplished that day.
If the boss asks you what did you do all day yesterday, you can immediately produce a detailed hour by hour activity log. This also comes in handy when the company wants you to long your time in a very detailed way.
I vaguely remember that someone posted a VB script to do that on Lifehacker. I didn’t feel like digging out the post so I just decided to implement it myself. You can go as simple or as complicated as you want with this. I opted for simplicity. I hacked up this nice little shell script:
echo What are you doing right now?
read -e what
echo `date` - $what >> timelog.txt
I really don’t think this can get any simpler than this. For a while I was toying with the idea of using XDialog. But then again I just wanted something quick, easy and robust. So I opted for pure bash.
Now I just needed to create a cron job. Unfortunately, by default cron will run shell scripts in the background. I actually wanted my script to pop up on the screen, get in my face and prompt me for input. So I used kstart to pop up a konsole window on all the desktops:
0,30 * * * * /usr/bin/kstart --windowclass "Konsole" --alldesktops --activate --ontop /usr/bin/konsole -e /home/lmaciak/track
I set my script to annoy me every half an hour. It gives me a better idea of how am I spending my time during the day. But if that’s to much for you, just delete “,30” from the line, and it will bother you once every hour.
One thing you have to remember is that cron daemon does not really know, or care about X environment. So you need to explicitly state which display should be used for the job. Add this somewhere in your cron file:
I added it above my cron jobs, but I don’t see why you couldn’t place it below them.
If you look in the timelog.txt code you will see nice grep-able output like this:
Thu Aug 10 15:00:15 EDT 2006 – responding to Bob’s email
Thu Aug 10 15:30:10 EDT 2006 – php class
Thu Aug 10 16:00:27 EDT 2006 – looking into setting up another demo
Thu Aug 10 16:30:15 EDT 2006 – php class coding
Thu Aug 10 17:00:17 EDT 2006 – coding eval.class.php
Thu Aug 10 17:30:19 EDT 2006 – replying to an email from ACE project (timesheet)
Most of these are very brief statements. For example, I can always go back and see what did I write to bob on August 10 around 3pm.
As an added benefit, that nag-window usually jolts me back to work. If I was idling, or wasting time, it forces me to concentrate on what I was supposed to do, and reminds me to get back to work. :mrgreen:
[tags]time, time tracking, time logging, bash, cron[/tags]