Get notified by email using mailx

Very simple script to get notified by email on job completion. Mostly I use this script for background jobs ran through ‘nohup’.
export FILE=/home/oracle/test.log
sqlplus “/as sysdba” @test.sql
mailx -s “test” < $FILE

spool test.log
select name from v$database;
spool off

Now test the script as

$ nohup sh >> test.out 2>&1 &

Check your inbox

Cheers !

Raheel Syed



About Raheel Syed

Oracle DBA
This entry was posted in Linux, Shell Scripting and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s