I've got a similar problem. I want my wife's computer to back up to the server once a day. I've set up unison and it works fine when I do a manual run. I can use the preferences file or just do it all from the command line:
Code:
/usr/bin/unison -batch /media/sda4/ "ssh://192.168.1.3//media/hdc1/Lena Backup/"
It works either way. I've even created a small script:
Code:
#!/bin/sh
echo "Began run" >> /home/sweetie/unison.log
date >> /home/sweetie/unison.log
/usr/bin/unison -batch /media/sda4/ "ssh://192.168.1.3//media/hdc1/Lena Backup/"
echo "Ended run" >> /home/sweetie/unison.log
date >> /home/sweetie/unison.log
This way I can watch unison.log and even if unison doesn't work, it'll still give me the date & time so I know the script ran.
I've also successfully set up a cron job to run the script, and I get output in unison.log so I know the script ran.
I even added the SSH keys so it won't ask for a password.
Here's the problem: unison won't run as part of a cron job. If I run the script, it will still put the date & time in unison.log, but unison itself won't run.
I've tried everything I could think of:
- run unison with a prefs file in crontab
- run unison with a straight command line in crontab
- run my script in crontab
- tried all these things in both the user's crontab as well as /etc/crontab
Doesn't work!!! She's running Kubuntu Feisty Fawn (brand new stable version). Cron, Anacron, Unison, and SSH are all running.
What on earth is going wrong? What did I miss? How do I fix it? I saw the suggestion to run fcron, but frankly I've got two cron programs running already. I'd rather learn how to use them properly. Any ideas???
Thanks in advance!!!