Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello
Can anybody explain how I can ftp the reult of a sql script in a shell script that is executed via a cronjob??I would like the result to be sent to a a folder on a different server or to a person's email address.Any help is appreciated.thanks
NC

hi
first create txt file liketxt.txt
Open Ip addresss
username
pwd
--if want to upload a file then
put filename
--if want to download a file
get filename
byeafter creating this text file.
call this text file from a batch file liketest.bat
ftp -s:txt.txt
here s =lower case
ftp is case sensitive
if wanna help for this
go to dos mode
ftp
help
or else
ftp
open tp address
remotehelptry this i have implemented this in my database.
bye
sankar

Hi NC,
why not logging the results of SQL with the spool - SQL statement into a file which you then can handle in any way you want ?
Or didn't I get your drift ?
W

Hello All
Thanks for the help..I have the ouput going to a .lis file but can I include the mailx command in the same shell script that I am using to execute the .sql file?. i.e I want the output file to be emailed to the user as soon as the sql script is run..-NC

Use the pipe command.
ls | mail user@host.com
ls | uuencode attachment.txt | mail user@host.com( ls ; cat /filename ) | mail user@host.com

Hello
Thanks david for the help, when I use the mailx command by itself outside the script its emailing the output but when I include it in the script The output is not getting emailed..follwing is the script:
#!/bin/sh
#/home/test
#connect to db
sqlplus -s /nolog <<EOF
connect sql/sql@test
@recon.sql
mailx nims_2k1@yahoo.com < recon.lis
exit
EOFwhere recon.lis is the output file.
thanks
NC

#!/bin/sh
#/home/test
#connect to db
sqlplus -s /nolog <<EOF
connect sql/sql@test
@recon.sql
exit
EOF
mailx nims_2k1@yahoo.com < recon.lis# mailx is not a sqlplus command
# or
(sqlplus -s /nolog <<EOF
connect sql/sql@test
@recon.sql
exit
EOF ) | mailx nims_2k1@yahoo.com

Or even use DBMS_JOB and UTL_SMTP within Oracle, and not bother with cron, shell, SQL*Plus etc.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |