Automating svn update

automation, bash, capistrano, ssh, svn

Solution

Sounds like a job for cron. Execute crontab, and add an entry like so:

#min hour date month day command
 0   *    *    *     *   ssh user@host '(cd path/to/working/copy; svn update)' 

You may need to set up ssh passwordless authentication with ssh-agent so that it won't prompt.

EDIT (per comments below):

Assuming you have sufficient privileges to do so, run

ssh user@host crontab -e

Then add an entry like so:

#min hour date month day command
 0   *    *    *     *   (cd path/to/working/copy; svn update)

You can ignore the part above the edit, unless your server doesn't allow you to use cron.

Problem

I'm frequently sshing into a server, switching to a specific directory and running svn-update I'm thinking that there's probably a very easy way to automate this, so I can simple specific a subdirectory when I run the script and it'll login via SSH, cd to the right directory and run svn-update. Is this a job for capistrano or could a simple bash script do the job?

Original source