i want to write bash file perform the following steps :-
copy file from server1
to server2
if (copy success )
do nothing
if (copy failed )
send e-mail to [email protected]
contain the following information
file name [copy failed]
i want to write bash file perform the following steps :-
copy file from server1
to server2
if (copy success )
do nothing
if (copy failed )
send e-mail to [email protected]
contain the following information
file name [copy failed]
On server1 --
SOURCE=a.txt
DEST=a.txt
R_HOST=server2
scp $SOURCE $R_HOST:$DEST || mutt -s "[copy failed] Copy of $SOURCE failed" [email protected]
Requires you have mutt installed. If you don't, get mutt, or replace the mutt portion with a sendmail
alternative.
mail
program. You can just replace mutt
with mail
in your command and get the same result and it's basically guaranteed to work.
mail
because i didn't install mutt
:)
Nov 28, 2010 at 10:31