The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to send email with usage of space in the directory as description : sakthifire Shell Programming and Scripting 3 04-18-2008 01:27 AM
need help in finding a string and to send an email using shell script ranga27 Shell Programming and Scripting 10 02-19-2008 02:54 PM
How to write a shell script to send an email to an id madhumathikv Shell Programming and Scripting 4 10-23-2007 02:19 PM
need help: how to send email with HIGH priority in shell scripts? _joshua_ Shell Programming and Scripting 2 03-12-2007 10:34 PM
Shell script to send email alert for core dump rtatineni SUN Solaris 1 08-17-2006 11:33 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-25-2002
cub cub is offline
Registered User
 

Join Date: Jun 2002
Location: Chicago
Posts: 8
Red face Shell to run query, encrypt and send email

Hello

To do :

'automate the process of generating report and send it to client every 15 days after encrypting the report file'

Did so far :

- generate Java program to encrypt the file.
- generate SQL query to run the report.

Is there any body who can help me to go further ?

Thanks in advance.
Forum Sponsor
  #2  
Old 06-25-2002
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
If you do a search of 'attach' and 'mail' on this site, there have been many suggestions on attaching files to an email. That should take care of your last step.

(You need to do it this way since you are encrypting and sending a file - I don't believe just 'mailx -s"test" joeuser@mycom.com < /myfile' would work)
  #3  
Old 06-25-2002
cub cub is offline
Registered User
 

Join Date: Jun 2002
Location: Chicago
Posts: 8
Arrow but for remaining.....

thanks for your reply.

You are right. I need to ecrypt the file first and then I can send an email with attachment. I have kind of figured out about that email attachment part but need help with other parts of the problem.

I'm thinking to use following syntax after encryption of file to send an email:

.uuencode /dir1/dir2/temp.file attachment.file | mailx -s "Sending information..." abc@xyz.com

Any help will be appreciated
  #4  
Old 06-27-2002
cub cub is offline
Registered User
 

Join Date: Jun 2002
Location: Chicago
Posts: 8
Smile conditions

I'm able to do all these three parts - run query, encrypt the file & send email within in a shell.

Now, I need help for generating checkpoints........ that means, need to put condition to check successful completion of query before encryption as well as to check successful completion of encryption before email part.

*** Please dispose your thoughts, if you have any. ***

Thanks
  #5  
Old 06-27-2002
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
If the main script is ksh or sh, then you can check for the exit status of the called program.

status=`echo $?`

This is assuming that you write a script to do these three parts.
In java I'm sure it has a way of breaking out on error and setting the exit value to non-successful.
  #6  
Old 06-27-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Using && at the end of commands will mean that only if that command is successful move on to the next one...can be useful.
__________________
Pete
  #7  
Old 07-10-2002
cub cub is offline
Registered User
 

Join Date: Jun 2002
Location: Chicago
Posts: 8
Question ...problem with email attachment

thank you - peter.herlihy & RTM for your response.

peter.herlihy -> It seems like '&&' is not working with my program.

RTM -> status=`echo $?` is working fine.

So, the problem I posted here has been resolved partially now because...

I was using my own company email id to test automated email generation with attached fine and it was working fine. Now, I find out that if I use my external email (like yahoo), attached file is being sent as a body of an email. Currently, I'm using...

uuencode /export/DATA_DIR/encrypted.file attachment.file | mailx -s "Schedule file delivery" myname@company.com

I have no authority or access to download anything on UNIX box. Is there anything else (which is in built) I can use or any syntax change ???

I'm very greatful to the people who are giving their valuable time here.
Google The UNIX and Linux Forums
Closed Thread

Tags
mailx, mailx attachment

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0