Home » Infrastructure » Unix » Attachment at Shell script (HP-UX, Oracle 10g)
Attachment at Shell script [message #438380] Fri, 08 January 2010 08:38 Go to next message
pokhraj_d
Messages: 117
Registered: December 2007
Senior Member
Hi,

I have written one shell script which will create log file named
Need_Index_rebuild.lst.

Now I want to send the file "Need_Index_rebuild.lst" as an attachment through mail to respective DBAs.

The mail is coming successfully through Unix box to the Outlook without attachment, but not able to attach the file with the mail.

Please help.

Regards-
Pokhraj Das
Re: Attachment at Shell script [message #438381 is a reply to message #438380] Fri, 08 January 2010 08:45 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

You don't provide an example of what you have done.
The topic will probably get locked since it not related to Oracle.

Anyway, try using
uuencode Need_Index_rebuild.lst Need_Index_rebuild.lst | mailx -s 'attachment' test@test.com 


Re: Attachment at Shell script [message #438574 is a reply to message #438380] Mon, 11 January 2010 01:08 Go to previous messageGo to next message
pokhraj_d
Messages: 117
Registered: December 2007
Senior Member
Hi ,
I have tried what you as per your post.
Not not able to send the report as an attachments.

Pokhraj
Re: Attachment at Shell script [message #438664 is a reply to message #438574] Mon, 11 January 2010 08:57 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>Not not able to send the report as an attachments.
It would be a little better if you can explain more.
There are several methods to do it.
Using uuencode is the most standard.
Re: Attachment at Shell script [message #438676 is a reply to message #438664] Mon, 11 January 2010 13:16 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
you'll probably find unix2dos useful to in giving the correct new-line styles.

## varies by platform
#UX2DOS=/usr/bin/ux2dos
UX2DOS="/usr/bin/unix2dos -437"

# convert Unix style new lines to Windows style
UX2DOS $LOG > $LOG.tmp
mv $LOG.tmp $LOG

mailx -s "Log attached..." $TO 1>/dev/null <<EOF
$(printf "Here is your log...\n";\
  printf "--------------------------------------------\n\n";\
  uuencode $LOG your_log.txt;\
  printf "--------------------------------------------\n\n")
EOF

[Updated on: Mon, 11 January 2010 13:17]

Report message to a moderator

Previous Topic: script for audit reporting
Next Topic: Installation 11g on AIX-planning dedicated server connection
Goto Forum:
  


Current Time: Mon Dec 02 06:20:05 CST 2024