i want to create a simple script to backup using rsync a folder on PC1 (suse 11) to PC2 (Windows XP) which can then be put into cron.hourly or cron.daily.
… it creates the files/folders/subfolders etc as expected (hoorah) BUT i get a message saying there was an error:-
bgrsvr-y:/etc/cron.hourly # rsync -avz /home/badger_fruit/data/photos/ /home/badger_fruit/lan/backup/
sending incremental file list
./
rsync: failed to set times on "/home/badger_fruit/lan/backup/.": Permission denied (13)
Aquarium/
CapeVerde/
Christmas2008/
Computers/
GardenProject/
LoftProject/
Misc/
School Photos/
sent 4175 bytes received 47 bytes 8444.00 bytes/sec
total size is 41067045 speedup is 9726.92
rsync error: some files could not be transferred (code 23) at main.c(1031) [sender=3.0.2]
bgrsvr-y:/etc/cron.hourly #
I have checked that “everyone” has “full control” on the Windows share and that the folder is not in “read only” mode.
The username and password provided in the fstab are also correct, if i do a manual cp, it will work without any such error.
an excellent idea, unfortunately, im a noob so don’t know how
there are only two users on the “source” pc, root and “badger_fruit”, would i just change the ownership of the “/etc/cron.hourly/backup” file or move it somewhere else on the filesystem?
If you want to run as some account, or even if you don’t, you should put jobs in /etc/cron.d, because that separates it from the system jobs and it’s easier to see that it should be retained across upgrades. The format is:
min hour day month weekday user command
e.g. a file /etc/cron.d/backupjob
2 2 * * * root /root/bin/dobackup
Every morning at 0202, run /root/bin/dobackup as root
To run as a different user, change the user field. But test that the user can indeed run the command. And remember that some environment variables will not be set, like $HOME, $DISPLAY, etc.
that would work?
(ie run at 01:00hrs every day as badger_fruit)
how would i know this had run? would it dump output to /var/log/messages, or some other place?
by the way, i ran it as badger_fruit and it “worked”, well, it gave the same error messages but didn’t complain about no permission to run this blah blah
ah har, that’s actually better for me, they are family photos and after my recent disaster i need to ensure i have a good mirror!
your code sample above, would that just dump the messages from the program output into a file and then append each time it’s run? because that is also fine, i can tail it if i want or open in nano/more/less/whatever.
Hi
Also remember to use the full path to rsync eg /usr/bin/rsync or use
the path statement at the begining.
I always use my own crontab for stuff like this, just run crontab -e to
create one. There are also some GUI tools for it as well, depends on
your desktop.
–
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel 2.6.27.7-4-default
up 1 day 6:50, 4 users, load average: 0.02, 0.07, 0.13
GPU GeForce 6600 TE/6200 TE - Driver Version: 177.82
well i tried it, i set it up to run 15 minutes past the hour each hour and it did work but didn’t dump the output to a text file, it seemed to mail it to root; a few moments after it ran (and it did run, hoorah!) i was told “new mail in /var/mail/root”
opened it and saw the output.
is it possible to dump output into a file instead of mail?
edit- i also saw i still got the same permission error, despite running as badger_fruit
Yes, the way I showed you. It should have been mailed to badger_fruit anyway so maybe you had not written out your changes or something else went wrong. If you want to append, change the > to >>.