Skip to main content

Thread: rsync script not working when run as cron job


this continuation of another thread started while back, since thread has got little of point thought should start new one.

problem trying contents of home directory external nas drive (buffalo linkstation) using simple script rsync, run cron job.

weird thing if run script manually terminal (using sudo), works fine. however, when put in /etc/cron.daily folder in hope run cron job, behaves differently.

important line in script file (which have called mybackup) looks this:

code:
rsync -tr --delete --exclude=".gvfs" /home/myname /media/lsduo
/media/lsduo mount point external nas drive. mounted via /etc/fstab, following line:

code:
//172.16.100.251/ubuntu /media/lsduo	cifs	auto,guest,noperm,_netdev	0	0
i have tried unrestrictive possible permissions, suspected problems might due permissions. fstab setup seems work, drive mounts correctly on startup.

script works if type

code:
sudo /etc/cron.daily/mybackup
at terminal. creates folder on nas drive entire contents of home directory. 1 strange thing owner of directory "user #99". perhaps that's sign isn't should be?

however, when runs cron job, although runs @ expected time, behaviour different. far can see, it's copying across, not respecting directory structure: loose in /media/lsduo folder.

gets weirder that. if view contents of folder through ubuntu pc, files have names such "\myname\documents\document.odt", if trying fit directory structure (yes, did have slashes right way round). documents seem corrupted in way, in can't open them.

on other hand, if view contents on windows pc, file names have become mangled, , have names such "_2zeg9~8.jpg" (the file extensions seem respected correctly). can open documents without problems on windows pc.

1 other piece of information may relevant: if try using -a option in rsync, error messages telling me chown failed within rsync.

permissions, isn't it? know might going on , how solve it?

i'm using ubuntu 11.04. external drive formatted xfs , set access permissions disabled. have used chmod set permissions on mount point folder 777.

notice run rsync when use sudo, means running root.

suspect if run without sudo, won't work (it's worth try see).

when run cron, there of course no sudo. that's why error message regarding chown.

suggest add root's cron instead of own. in other words, first delete entry cron; create entry in root's cron:
code:
sudo crontab -e


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] rsync script not working when run as cron job


Ubuntu

Comments

Popular posts from this blog

Falang and too many redirects - Joomla! Forum - community, help and support

Infinite loop detected in JErrorInfinite loop detected in JError - Joomla! Forum - community, help and support

logged out from joomla! - Joomla! Forum - community, help and support