![]() |
|
|
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 |
| How the first script should notify in case there is no response from second | rajusa10 | Shell Programming and Scripting | 4 | 03-19-2008 01:35 PM |
| Notify Command. | venkyA | UNIX for Dummies Questions & Answers | 2 | 08-21-2007 07:20 AM |
| Capturing last command execution status in a script. | videsh77 | Shell Programming and Scripting | 2 | 04-12-2007 02:19 PM |
| Script to e-mail me when a command is done | rocker40 | UNIX for Dummies Questions & Answers | 2 | 01-15-2004 06:31 PM |
| process pager - by cell phone or just e-mail notify | squash | UNIX for Advanced & Expert Users | 9 | 10-23-2001 04:34 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Using mail command to notify the status of script
Can someone please help me with this script, I'm trying to create system backup on AIX, for this I want to first mount the filesystem if it is not mounted, then create the backup and unmount the filesystem but I'm having problem while using the mail command to notify the status of filesystem whether it can be mounted or not, it doesn't send an email and doesn't append anything to the log files, also how do I calculate the time the script is taking to complete, is there a command I can use within the script ?
#!/usr/bin/ksh set -x HOSTNAME=$(hostname) fs=$(df|grep testfs | awk '{print $7}') if [ -z "$fs" ]; then echo "Mounting filesystem..." mount /testfs mail -s "Filesystem mounted with success" -c "xxx@email1 yyy@email2"</var/log/succes.err >/dev/null else mail -s "No such filesystem exists on $HOSTNAME" -c "xxx@email1 yyy@email2"</var/log/miss.err >/dev/null exit fi ## If cannot mount then run, if [ $? -ne 0 ]; then mail -s "Cannot mount filesystem for $HOSTNAME" -c "xxx@email1 yyy@email2"</var/log/fail.err >/dev/null exit fi Last edited by mbak; 07-15-2008 at 09:43 PM.. Reason: typo |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|