… 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)
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]
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.
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.
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