Re: rsync script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kaushal Shriyan wrote:
Hi

MAILTO=kaushal@xxxxxxxxxxx
0 18 * * * rsync -av /var/lib/mysql kaushal@host77:/var/lib/

If i put this two lines in crontab it will run correctly,My requirement was
to create a script, this script should indicate success or failures and the
reason for failure


Rsync should already be telling you that in the email that cron sends but you probably aren't bothering to read it because the -v option makes it too verbose. If you you can't get rsync to say exactly what you want with some variation (or omission) of the -v and -q options you could replace the success output with an invocation like: 0 18 * * * rsync -a /var/lib/mysql kaushal@host77:/var/lib/ >dev/null && echo Rsync succeeded

Cron only sends mail if the command generates anything on stdout or stderr. The >dev/null will discard normal output but keep any error messages from rsync (which would go to stderr instead of stdout). If the run succeds with no error, the command to the right of the && will run so you still get an email.

Somehow the way you stated the 'requirement' for a script makes this sound like a homework assignment from someone who expects it to look like cobol, though...

--
  Les Mikesell
   lesmikesell@xxxxxxxxx



--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux