Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Script to send data
Hi All,

I am newbie to Unix and Shell script and Python. Can you please help me to write a Python script.

Below is my requirement.

1.Send in email every 15 minutes from 12 to 3:30 PM. It has to create a backup files from 12- 3:30

E-mail should only be sent ONLY when below Query have data return else need to raise an exception " there is no data"

Query : SELECT * from EMP where DEPT = 87;

2. Email format:
To: xyz
From: abc
Email Subject:
Email content: <data return from below query>


I have written a code in UNIX. Anyways that code is not working. Below is my code.Please look into the code and hemp me to write it in both Shell and Python.
#FILE="EMP_DETAILS.$(date +%F_%R).txt"
#touch $FILE

echo $ORACLE_HOME/bin/sqlplus
echo "======== START ============="

#$ORACLE_HOME/bin/sqlplus -s scott/tiger@XE <<EOF

set pagesize 0 feedback off verify off heading off echo off
column last_business_date format date
SELECT * from EMP where DEPT = 87;


echo $RESULT > $FILE
#sed -i 's/#^/\n/g' $FILE
sed '/#^/G' $FILE
echo "======== END ============="

#FILE1="EMP_DETAILS.$(date +%F_%R).txt"
# while IFS= read -r line
# shnfix "$line"
# done < "$FILE1"
#} > "emp.backup.$(date +%F_%R).txt"

##this will fetch the number of lines in the file
#wc -l $FILE1
#if [wc -gt 0]; then
mail -s "!!! WARNING File" << $EMP_DETAILS.txt
echo "The IDL processing has been completed for Business date $BUSINESS_DATE." | mail -s "IDL Processing Status $env" "" -- -r "robin@gmail";
buran wrote Nov-06-2017, 07:12 AM:
What have you tried? We are glad to help, but we are not here to do your work for you.
Please, post your code (in code tags) and ask specific questions. Don't forget to include the full traceback (in error tags) if you get one.
just full quote of OP
buran wrote Nov-07-2017, 07:14 AM:
Full quote of the OP deleted

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Regex to retrieve data from json in script tag. DreamingInsanity 4 546 Dec-20-2019, 06:18 PM
Last Post: DreamingInsanity
  python script fails with a lot of data bluethundr 2 188 Nov-11-2019, 01:35 PM
Last Post: bluethundr
  Is this possible in Python? Auto-Send-to-printer on script run? pcsailor 8 3,820 Jul-19-2019, 09:33 AM
Last Post: perfringo
  waiting for the first of many pipes to send data Skaperen 7 585 May-05-2019, 10:57 PM
Last Post: Skaperen
  Data Validation script in python Tulsi 1 1,282 Jul-17-2018, 03:54 PM
Last Post: Tulsi
  Send and receive Files(data/images) betwenn a python app and another appl Akhou 2 922 May-02-2018, 08:20 AM
Last Post: Akhou
  sending data to second python script Cyberfly 1 1,117 Jan-29-2018, 10:09 AM
Last Post: Cyberfly

Forum Jump:

Users browsing this thread: 1 Guest(s)