Adding date to the subject using mailx


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Adding date to the subject using mailx
# 1  
Old 01-03-2011
Adding date to the subject using mailx

Hi ,

I want to add date to the subject of the email. I am using mail and used

Code:
-s "SQL Loader was not able to load enid on `date`  due to data error"

But it didnt work. can any one help me ??


Thanks
Sithara
# 2  
Old 01-03-2011
I tried a simple test:
Code:
echo "SQL ... on `date` due to ..."

and got:
Code:
SQL ... on Mon Jan  3 12:51:02 EST 2011 due to ...

Can you provide additional details? More of your shell script, etc etc.

Also, I would like to suggest you use:
Code:
echo "SQL ... on `date '+%Y-%m-%d %H:%M:%S %Z'` due to ..."

because it is much easier to sort when your subject lines reads something like:
Code:
SQL ... on 2011-01-03 10:53:04 MST due to ...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Variable not displaying in subject line of mailx email

Hi Newbie here with first post. I've got a shell script (ksh) whereby I run a SQL*Plus script and output the results to a file. I then check the output file in an if statement that looks like this: if ]; then export GAPNUM=`awk '{print $4}' $OUTFILE` if ] then mailx -s... (10 Replies)
Discussion started by: ltzwoman
10 Replies

2. Shell Programming and Scripting

Content of attachment is displaying along with subject in mailx

Hi All, I want to send the csv to an email address. I have tried the below two approaches. Approach1: Got error -ksh: uuencode: not found $ uuencode test_file.csv test_file.csv | mailx -s "Attaching test" msdc.kiran@gmail.com </usr/home/test_file.csv -ksh: uuencode: not found Approach2:... (6 Replies)
Discussion started by: ROCK_PLSQL
6 Replies

3. Shell Programming and Scripting

Adding Pager notification to mailx command.

Is it possible to add Pager Notification to mailx command?? :confused: Or by any other mean. ---------- Post updated at 08:49 AM ---------- Previous update was at 07:08 AM ---------- Hi just want to specify that by Pager i mean a message to the mobile number. Suppose i have following... (1 Reply)
Discussion started by: Sharma331
1 Replies

4. Shell Programming and Scripting

Mailx - Adding timestamp in CSV file

Hi allI am mailing csv file to our lotusnote server using shell script. I am using command to get require date/time :date +"%d%b%y-%X%p"File name is :TESTFILE-29Jan14-09:00:00AM.csv.When I am receving this on lotusnote server coming as "00AM.csv" rest of the string is getting truncated. I feel due... (1 Reply)
Discussion started by: krsnadasa
1 Replies

5. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

6. Shell Programming and Scripting

Adding days to system date then compare to a date

Hi! I am trying to read a file and every line has a specific date as one of its fields. I want to take that date and compare it to the date today plus 6 days. while read line do date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD if ; then ...proceed commands ... (1 Reply)
Discussion started by: kokoro
1 Replies

7. Shell Programming and Scripting

adding hostname and date in subject of the mail

Hi Team, I coded my code to send mail to some reciepents with subject and date. Can somebody suggest me how to add host name to subject ? and the below code is correct for date ? my aim is to send mail with "subject in < hostname> on <date>".When i execute this script on my server its hung... (3 Replies)
Discussion started by: rocking77
3 Replies

8. Shell Programming and Scripting

How to extract the subject from a script which uses mailx

Hi, I need to extract the subject of an e-mail sent using mailx. mailx is in a a file and the command reads like the following Ex: sendMail.sh mailx -s ' This is the subject' $recepiant note that anything can come within ' ' which goes to the subject. Please help (5 Replies)
Discussion started by: mwrg
5 Replies

9. Shell Programming and Scripting

executing/including command in mailx subject line

Hi, Is it possible for me to include the results from a command in the subject line? What I am looking to do is get the file count and include it into the subject line as well as the list of files in the body. Example Subject line: Currently 25 files in directory My Code: #!/bin/ksh cd... (2 Replies)
Discussion started by: ozifer
2 Replies

10. Shell Programming and Scripting

mailx in cron using variable date

I am using a popular HOSTUMP script that dumps successfully to a log file named servername_a_`date +%m%d%y`.log I then want to kick off a second cron job that will email me that log. I am assuming it has to be something like 00 07 * * 2 mailx -s 'SERVERNAME Tape A Weekly Backup Log'... (1 Reply)
Discussion started by: seaquin
1 Replies
Login or Register to Ask a Question