Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a shell script that performs some tasks using files from a Subversion repository. I would like the Subversion repository to keep up-to-date, but right now the script runs svn up every time which is annoying if I need to run the script several times in a row.

Since svn up changes the last modified timestamp of the .svn directory (even if there were no new commits), I figured that I could use that to make sure it only runs svn up once per day or so.

I tried finding a simple way of just checking whether the .svn directory is older than a day, but there were many seemingly overkill ways of doing it so I thought I'd ask here in case there's actually a very simple way to do it.

share|improve this question
up vote 4 down vote accepted

This is somewhat simple:

[ `find /path/to/.svn -maxdepth 0 -mtime +1 | wc -l` -gt 1 ] && svn up
share|improve this answer
Thanks! :) :) :) – Blixt Nov 3 '10 at 22:54

Maybe I am missing the big picture here, but can't you just run a once-daily cron job to update the svn repository?


crontab -e

then add a

4 * * * /root/

where contains

cd /my/directory
/usr/bin/svn up

or something like that?

share|improve this answer
The idea is that the directory that has this script is self-contained. I'd rather not set up cron jobs since it's part of an open source project. So deleting the directory of the project should mean it's completely gone. – Blixt Nov 2 '10 at 22:45

Your Answer


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.