LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-11-2013, 09:36 AM   #1
rajini23
Member
 
Registered: Sep 2011
Posts: 162

Rep: Reputation: Disabled
mail should be generated after backup complets


hi,

I wants to copy the file from on machine to another regularly
using the script so i used to run this script...

scp -rp /opt/test raj@180.190.40.45:/opt/test1

it is working fine but i wants to run every 4 hours i have added in crontab also but i wants to get the mail once the data transfer is completed..
please help me in to get the mail once the data transfer comepletes succefully... using script???
 
Old 02-11-2013, 10:03 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by rajini23 View Post
hi,

I wants to copy the file from on machine to another regularly
using the script so i used to run this script...

scp -rp /opt/test raj@180.190.40.45:/opt/test1

it is working fine but i wants to run every 4 hours i have added in crontab also but i wants to get the mail once the data transfer is completed..
please help me in to get the mail once the data transfer comepletes succefully... using script???
That's not a script...that's a single command on one line. If you put it in a file, and put a line beneath it to send you an email, THEN it's a script. There is a link to a scripting tutorial in my post signature...please read it, and it should tell you what you need to know.
Code:
#!/bin/bash
scp -rp /opt/test raj@180.190.40.45:/opt/test1
echo "message" | mail -s "Subject" user@domain.com
There...a script that sends you an email when the scp job is done.
 
Old 02-11-2013, 10:10 AM   #3
rajini23
Member
 
Registered: Sep 2011
Posts: 162

Original Poster
Rep: Reputation: Disabled
Thanks for your reply, But if data transfer failed how do i know???
 
Old 02-11-2013, 10:29 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
If it is running cron you will get a mail message of the activity log each time the entry runs.
 
Old 02-11-2013, 10:34 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by rajini23 View Post
Thanks for your reply, But if data transfer failed how do i know???
That's the part where YOU write your script to check such things. We will be glad to help, but again (as in your other thread), we aren't going to write your scripts for you.

You have many options; you can check the file size from the originating server and compare it against what you've got on the receiver, take an MD5 checksum and compare it. Those are just two.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto reply mail generated in linux !! shipon_97 Linux - Newbie 1 12-20-2008 10:31 PM
how to take copy of all incomming mail in another a/c except mail generated by server parashar_singh8086 Linux - Server 1 09-30-2007 04:22 AM
Why have I stopped receiving system generated mail? darthfoolish Linux - Software 3 02-07-2007 09:31 AM
Backup Mail Server inversecow Linux - Networking 1 01-04-2006 02:30 PM
I am trying to send an program generated e-mail! rutman Linux - General 0 06-15-2004 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration