Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know several tools that allow tracking time spend on different tasks / projects.

Is there any existing tool for very very simplified work-time-tracking.

Scenario:

I am an employee, come to the office, switch on my laptop directly. I have mostly around 1 hr lunchtime, but sometimes less, sometimes more.

At around 18:00 I want to type one command in the console (or simple GUI would also be okay of course) that tells me:

"1 hour overworked. Go home now! (came at 8:00, 1 hour standard lunch-break)."

Maybe there could be some parameter

mytool -lunch 2

"0 hour's left. Go home now! (came at 8:00, 2 hour lunch-break)."

Is there anything simple like that already?

Should run on Linux, COmmandline, maybe just a bash or python script.

EDIT: Solution by Akira - thanks!

$ mytool 2 | figlet
               _                            
  __ _  ___   | |__   ___  _ __ ___   ___   
 / _` |/ _ \  | '_ \ / _ \| '_ ` _ \ / _ \  
| (_| | (_) | | | | | (_) | | | | | |  __/_ 
 \__, |\___/  |_| |_|\___/|_| |_| |_|\___(_)
 |___/                                      
                        _              __________  __   
  _____   _____ _ __ __| |_   _  ___  |___ /___ / / /_  
 / _ \ \ / / _ \ '__/ _` | | | |/ _ \   |_ \ |_ \| '_ \ 
| (_) \ V /  __/ | | (_| | |_| |  __/  ___) |__) | (_) |
 \___/ \_/ \___|_|  \__,_|\__,_|\___| |____/____/ \___/ 

                              _       
 ___  ___  ___ ___  _ __   __| |___   
/ __|/ _ \/ __/ _ \| '_ \ / _` / __|  
\__ \  __/ (_| (_) | | | | (_| \__ \_ 
|___/\___|\___\___/|_| |_|\__,_|___(_)

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

bash (put to your ~/.bashrc):

function mytool() {

    # ${1-0} means: take the first argument or assume 0 if 
    # no argument was given

    MAX="$(( (8 + ${1-0}) * 3600))" # $1 carries additional hours
    UP=`cat /proc/uptime | sed 's/\..*//'`

    if (( $UP > $MAX ))
    then
        echo "go home. overdue $(( $UP - $MAX )) seconds."
    fi
}

just call it like mytool 2.

or .. awk (just for the fun of it):

awk -v lunch=2 'BEGIN { max=(8 + lunch) * 3600;} { if ($1 > $max) print "overdue " ($1 - max) / 3600.0 " hours"; }' /proc/uptime
share|improve this answer
    
Hey this is not stack overflow :-) Thanks for the great answer! Seems to work. –  Alex Jul 28 '10 at 15:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.