rsync with e-mail notification failure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rsync with e-mail notification failure
# 1  
Old 09-28-2012
rsync with e-mail notification failure

dear all,

i have script rsync like this :
Code:
#!/bin/sh
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
RUSER=root
RHOST=123.123.123.1
INTRPATH=/home/jargo/log/internasional/
INTHPATH=/var/www/international/
IIXRPATH=/home/jargo/log/iix/
IIXHPATH=/var/www/iix/
TTLRPATH=/home/jargo/log/total/
TTLHPATH=/var/www/total/

$RSYNC -az $INTHPATH --include='*log' --include='*old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$INTRPATH
$RSYNC -az $IIXHPATH --include='*log' --include='*.old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$IIXRPATH
$RSYNC -az $TTLHPATH --include='*log' --include='*.old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$TTLRPATH

i won if rsync failure all or or any of rsync commands are, will be in the email as an email notification errors

Cyd

Last edited by Franklin52; 09-28-2012 at 06:30 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 09-28-2012
Code:
ERR=0
$RSYNC -az $INTHPATH --include='*log' --include='*old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$INTRPATH  || ERR=1
$RSYNC -az $IIXHPATH --include='*log' --include='*.old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$IIXRPATH
|| ERR=1
$RSYNC -az $TTLHPATH --include='*log' --include='*.old' --exclude='*' -e "$SSH" $RUSER@$RHOST:$TTLRPATH || ERR=1
if [ $ERR -eq 1 ] ; then
   echo 'rsync failure' | /usr/bin/mailx -s 'rsync error me@mycompany.com
fi

See if that meets your needs.
# 3  
Old 10-02-2012
the errors message is :
Code:
/usr/sbin/rsync-backupmrtg: line 17: [: -eq: unary operator expected

this is my script
Code:
if [ $ERR -eq 1 ] ; then
  echo 'rsync failure' | /usr/bin/mailx -s rsync error indracyd@yahoo.co.id
fi

what wrong?
thanks before

Last edited by Franklin52; 10-02-2012 at 06:54 AM.. Reason: Please use code tags for data and code samples
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. SuSE

Notification for audit processing failure

Dear users, I have SLES 11 and SLES 10 servers. I'd like to receive an alert when audit log files reach certain percentage of full. 1. Is '/etc/audit/auditd.conf' the right file to modify? 2. I'd like to receive email alert. Can I specify my email in this parameter ... (0 Replies)
Discussion started by: JDBA
0 Replies

2. Shell Programming and Scripting

Script for sending notification mail

hi all, needed a script to send a notfication mail if the specified folder had the copy of the files that are older than 15 days i.ee for example my folder name is SAi and the files are as follows sai.txt copyofsai.txt copyofcopyofsai.txt hemanth.txt copyofcopyofhemanth.txt... (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

3. Shell Programming and Scripting

Add Email Notification to Rsync

HI what i need to be able to do is add a email to the end of a rsync. my current ion configures writes a daily log to disk, but real want to send the log to a central email address. The current script is as below, is this possible? #!/bin/bash if then rsync -aWv --stats progress... (3 Replies)
Discussion started by: treds
3 Replies

4. Shell Programming and Scripting

Rsync through java program - issues with remote connection failure

Hi Everybody, I am running rsync through my java application. The Java application will sync the files with remote machine. During our connection failure testing we noticed an issue running rsync through java program. The java application which is running at source side is not receiving any... (2 Replies)
Discussion started by: MVEERA
2 Replies

5. Shell Programming and Scripting

Restrict the mail upon first failure mail.

Hi, I have a application which send mail to the respective client upon success or failure case of file transfer, upon success there is no problem. But in case of failure that application is running again in cron job,so still success of file transfer the client will get the failure notification.... (5 Replies)
Discussion started by: posix
5 Replies

6. Shell Programming and Scripting

AIX mail notification

plzzz help me, I want to send emails for exchange group members when the used file-system % gets more than 90%, this notification must include df -g, netstat -i,and errpt with the hostname thx in advance (0 Replies)
Discussion started by: majd_ece
0 Replies

7. Infrastructure Monitoring

Mail Notification in nagios

Hi guys, I have configured Nagios in My Ubuntu8.4 machine through Quickstart Guide, All things are working fine. Now i want to get Services Notification mails on my personal Email-id,what configuration is needed to get the mails,any assistance would be appreciable. Thanks in advance. (3 Replies)
Discussion started by: daya.pandit
3 Replies
Login or Register to Ask a Question