Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send report to email input

Status
Not open for further replies.

grapes12

Technical User
Mar 2, 2010
124
0
0
ZA
I have a new script to complete, which needs to be done using a menu.Once the option is selected on the menu the user should enter his email address,which will run a oracle SQL script and email the output to the user whose email was entered.
here is what I've done thus fur:
#!/usr/bin/ksh
WORKDIR=/u1/home/ops
SPOOLFILE=/u1/home/ops/menopt15.lst
LOGO="Users Takeon/Expired"
LIST="xxx@help.co.za xxxb@help.co.za xxxc@help.co.za graham.goliath@gmail.com"
#Option1=" Run User Takeon Report" ;
#Option2=" Run User Expired Report" ;
#Option3=" Exit Program" ;

Displaymenu () {
clear
echo `DATE`
echo
echo "\t\t\t\t" $LOGO
echo
echo "\t\Select Option:"
echo
echo "\t\t\t [1] Run User Takeon Report "
echo "\t\t\t [2] Run User Expired Report "
echo "\t\t\t [3] Exit Prgram "
echo -n "Enter option then ENTER to continue:;"
}
PressEnter () {
echo Press Enter
read x
}
# A function for each of the menu picks

Function Takeon()
{
echo " Executing Run Takeon Report "
echo " Enter email address then enter to continue: \c"
read email
sqlplus -s mac/mac789@${WORKDIR}/takeondate.sql
}

Function Expired()
{
echo "Executing Run Expired Report"
sqlplus -s mac/mac789@${WORKDIR}/expirydate.sql
}

Function Exit()
{
echo "Exit Program"
# ... perform certain actions
}

while true
do
displaymenu
read answer
case $answer in
1] Run User Takeon Report ;;
2] Run User Expired Report ;;
3] break ;;
esac
done
clear
 
do you have mutt installed,

mutt -s "subject line" -a /path/to/filename someone@somewhere.com </dev/null

This will send the report for you.


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top