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.

Your email will never ever be published.

Previous:
Pixoh.com and Instant Domain Search May 16, 2006 Misc. links
Next:
isInt() JavaScript function May 22, 2006 Web development
Related by category:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
brotli_static in Nginx November 8, 2024 Linux
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Linux
Linux tip: du --max-depth=1 September 27, 2007 Linux
Related by keyword:
Real minimal example of going from setState to MobX May 4, 2018 React, JavaScript
Crontabber June 12, 2014 Python, Mozilla, PostgreSQL
crontabber now supports locking, both high- and low-level March 4, 2017 Python, Mozilla, PostgreSQL
One thing I hate about Linux: cron March 31, 2008 Linux