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.


This is somewhat simple:

[ `find /path/to/.svn -maxdepth 0 -mtime +1 | wc -l` -gt 1 ] && svn up

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/updatecron.sh

where updatecron.sh contains

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

or something like that?

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.