When I ssh into our development server, I automatically CD into a work directory, do a 'cvs up -d' (-d picks up new directories) and then run all of the tests. However, I almost always ssh into dev twice because one window is for my code and another window is for my tests and I'm tired of hitting <ctrl-c> all the time on the second window. With the help of smylers explaining some odd (to me) bits of bash syntax, I now use something like this:
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
if [ -e $timestamp ]; then
let elapsed="$curr_time - $last_time"
if [ $elapsed -gt 600 ] # five minutes
`perl -e 'print time' > $timestamp`
/usr/bin/cvs up -d
With that, if I've ssh'd into the dev server and run the tests within the last five minutes, the next ssh will not do the cvs up or run the tests. It could probably be cleaned up more since I'm not much of a bash programmer, but it's pretty handy.