![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatic FTP script | texastig | SCO | 4 | 06-02-2009 07:08 PM |
| Automatic backup for sporadically connected clients with Box Backup | iBot | UNIX and Linux RSS News | 0 | 08-29-2008 05:20 AM |
| Automatic script | TShirt | UNIX for Advanced & Expert Users | 5 | 06-05-2008 05:34 AM |
| Script for automatic deletion of old files | vivek_scv | Shell Programming and Scripting | 4 | 09-09-2007 02:57 AM |
| Automatic login script | dayanand | Shell Programming and Scripting | 3 | 01-08-2006 07:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Email script when automatic backup is finsihed
Hello all,
i'm still new to this site and thought i might find some help here .lately i performed a script to make an automatic backup of some files in certain directories. the script looks something like this: Code:
#! /bin/bash ##############VARIABLES path=/export/home/cassi/Backup timestamp=`date +%Y%m%d` host=`hostname` file_in=$path/files2tar tarfile=$path/$host-$timestamp-bak.tar ################TAR AND GZIP FILES data=`cat $file_in` tar cf $tarfile $data /usr/bin/gzip $tarfile My question is this. I need to find a way to make an automatic email if all files are successfully transfered. is there a way to perform this? Thanks for reading, Matthew Last edited by vgersh99; 10-02-2009 at 09:38 AM.. Reason: code tags, PLEASE! |
|
||||
|
Thanks for your reply. Forgive my ignorance, i am still very new to UNIX and scripting. Can you show me such example?
thanks. ---------- Post updated at 08:01 AM ---------- Previous update was at 08:00 AM ---------- Thanks ggs i will try that! ---------- Post updated at 08:22 AM ---------- Previous update was at 08:01 AM ---------- Hi ggs, is there a way to cinfigure mailx? the reason is that the files are stored in this machine which i then need to receive an email on a windows machine. |
|
||||
|
Hi Wizard,
Try the following - Code:
data=`cat $file_in` tar cf $tarfile $data > /dev/null res1 = $? /usr/bin/gzip $tarfile > /dev/null res2 = $? if [ $res1 -eq 0 ] && [ res2 = 0 ]; then echo "BackUP & Zip operation successful." > /tmp/mailtext elif [ $res1 -eq 0 ]; then echo "BackUP is successful. Some issue in Zip operation." > /tmp/mailtext elif [ $res2 -eq 0]; then echo "Backup Failed" > /tmp/mailtext fi mailx -s "Backup Result" <your email id> < /tmp/mailtext rm /tmp/mailtext #Done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|