Kung Fu Kung Fu

Fujian White Crane Kung Fu

Zope Zope

What I have and am doing with Zope

Photos Photos

Photoalbum, both old and new.

Receptsamlingen Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me Contact me

My contact details and how to contact me.

  Mobile version of this page Mobile version of this page


 

SVN + ./todo + crontab

svn, /todo, crontab, todolist, jan, todo

19th of May 2006

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.


Comment

 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.