Shell to run query, encrypt and send email

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell to run query, encrypt and send email
# 1  
Old 06-25-2002
Power Shell to run query, encrypt and send email


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.
# 2  
Old 06-25-2002
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" < /myfile' would work)
# 3  
Old 06-25-2002
CPU & Memory 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..."

Any help will be appreciated
# 4  
Old 06-27-2002
Bug 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. ***

# 5  
Old 06-27-2002
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
Using && at the end of commands will mean that only if that command is successful move on to the next one...can be useful.
# 7  
Old 07-10-2002
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"

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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run remote command and send email

I am currently try to write a simple script with the following condition, but so far not having luck as the exit code would always be 0. Run remote command to read a file and grep for test word. if test word is in the file, send email. if not, do nothing also possible to ssh to multiple... (3 Replies)
Discussion started by: jaapar
3 Replies

2. Shell Programming and Scripting

Script that will send an email if the cron job did not run.

Team, Would like to know what is the best script that will send you an email if cronjob did not run. Thanks (4 Replies)
Discussion started by: kenshinhimura
4 Replies

3. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

4. Shell Programming and Scripting

SQL query output convert to HTML & send as email body

Hi , I have a sql query in the unix script ,whose output is shown below.I want to convert this output to HTML table format & send email from unix with this table as email body. p_id src_system amount 1 A 100 2 B 200 3 C ... (3 Replies)
Discussion started by: jagadeeshn04
3 Replies

5. Shell Programming and Scripting

Help with shell script to send email once

Hi Guys, I have this script which will monitor oracle db process if up or down.And I want it to send email if it's down and the time it's back to online. However my script just keep on sending "Email Up" if the db is up or "Email Down" if the db is down.Is there any way to trap it so that it... (5 Replies)
Discussion started by: d3xt3r
5 Replies

6. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

7. Shell Programming and Scripting

How to send email through shell script

Hi All, I am new to the unix , i have to deliver one script very urgently I have to write a shell script where i have i want to send email to specific email id in this script i want FROM to be parameterized and stored in a variable TO to be parameterized and stored in a variable... (3 Replies)
Discussion started by: nileshbhawsar
3 Replies

8. Shell Programming and Scripting

Send Email using Korn Shell

Hi All, I need assistance is sending email out using korn shell Steps, 1- Count number of records in database. 2- if count is more than 2000 3- send email to user else if less then 1999 exit out. Here is my script and is not exiting out and need to press .DOT and Enter command to... (2 Replies)
Discussion started by: atlurip
2 Replies

9. Shell Programming and Scripting

We need a script that invokes the sql query every 14 days ans send email

HI, We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies

10. Shell Programming and Scripting

We need a script that invokes the sql query every 14 days ans send email

Hi, We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies
Login or Register to Ask a Question