SVN + ./todo + crontab

20 May 2006   1 comment   Linux

Powered by Fusion×

I've now started playing with ./todo which is a really promising method (for me) for maintaining a simple todolist. When at work I more or less live on the command line and can do things there much faster than I can with an online todolist or a proper GUI. Now I simply write:

$ todo add Call Jan about svn repo

and it adds "Call Jan about svn repo" to my todo list. To view the todo list I simply write:

$ todo list

Every item in the list has a number which you can use to mark things done or change priority.

Anywho, now I've put my little todo.txt in my personal SVN repository on one of our servers. But, how do I make sure that my changes to the todo list are always backed up with SVN (subversion)? I could hack the ./todo script to do a svn commit on every change and svn update every time I do a ./todo list but that would be far too slow.

So, I created a little shell script with some help from my colleague Jan. It's meant to be run every 10 minutes and it will only work if there's a network connection. If there's a conflict, a message is sent to all open terminals with the program wall. Long story short, here's the code:

#!/bin/sh
[ -f ~/WORK/TODO/todo.txt.mine ] && {
  [ ! -f /tmp/SVN_conflict_warning_sent ] && {
  echo "SVN conflict with ~/WORK/TODO/todo.txt" | wall;
  touch /tmp/SVN_conflict_warning_sent;
  exit 1; }
}  

ping -c 1 svn.fry-it.com > /dev/null 2>&1
[ $? -eq 0 ] && {
  svn update ~/WORK/TODO > /dev/null 2>&1;
  svn commit ~/WORK/TODO > /dev/null 2>&1;
}
[ -f /tmp/SVN_conflict_warning_sent ] && {
rm /tmp/SVN_conflict_warning_sent;
}

I've only just started this and I might have made some errors. I tried it around a bit before sticking it inside a cron job and it seems to work.

I'll write more later about if todo works for me. You never know, I might get bored and go back to pen and paper again.

Comments

Cezary Okupski
You don't have to run it as a cron job if the problem was that commiting was slow. You could add an ampersand at the end (like this: ./foobar.sh &) and detach the execution from your current shell session into a subsession. Anyway, a nice script.
Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
Pixoh.com and Instant Domain Search 16 May 2006
Next:
isInt() JavaScript function 22 May 2006
Related:
Crontabber 12 June 2014
ToDo apps I gave up on in 2010 03 January 2011
One thing I hate about Linux: cron 31 March 2008
How to uninstall nginx with apt 28 March 2008
Redirect stderr into becoming dots in Bash 02 September 2006
Amazon bug in shopping basket 05 September 2005
Crontab wizard 13 January 2004