I am trying to figure out how to run a SSH command via cron for linux. The command I want to run is:
svn update /path/to/working/dir
Something like:
*/1 * * * * root ssh svn update /path/to/working/dir
Anyone know what I would need to do with the cron line?
EDIT: I don’t need it to be SSH, just need to run svn update on the same server as cron to the working directory.
EDIT 2: What I was looking for was:
*/1 * * * * svn update /path/to/your/working/copy
I worded it incorrectly though, asking too specific about SSH, so I awarded the answer that talks about cron via SSH specifically, but if anyone wants to know how to do it locally, you don’t need SSH.
Advertisement
Answer
You need to pass the host name (and also the username, unless you want to log in as root) to SSH:
*/1 * * * * root ssh user@hostname svn update /path/to/working/dir
Also see ssh --help
for more information.
Note that you’d need to input your password with SSH, unless you’ve setup your SSH to be able to log in without password