# Crontab + Script + .sql

**URL:** <https://community.unix.com/t/crontab-script-sql/316525>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [September 11, 2012, 12:31pm UTC](https://community.unix.com/t/crontab-script-sql/316525 "2012-09-11T12:31:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Newer](https://community.unix.com/letter_avatar/newer/32/6_449c533f586939b6e5f246632a46421f.png) [@Newer](https://community.unix.com/u/Newer)\
**Post date:** [September 11, 2012, 12:31pm UTC](https://community.unix.com/t/crontab-script-sql/316525/1 "2012-09-11T12:31:25Z")

</div>

Hi guys today i'll bring to you a new problem that i need to execute.  
So what i need to do it's create a script that:  
conect to some database  
logon  
run a .sql script  
logoff  
and close the connection  
after that, put this script on the crontab

To set up the crontab it's ok for me, i think it's not a big deal. One more thing to do i need this file, cause my boss need to validate my task  
SPOOL sspev\_host\_cleanup.log  
Any help please?

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_449c533f586939b6e5f246632a46421f.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [September 11, 2012, 1:15pm UTC](https://community.unix.com/t/crontab-script-sql/316525/2 "2012-09-11T13:15:10Z")

</div>

You need that file as in what? Is it on the wrong machine?

---

<div class="post-metadata">

**Author:** ![Newer](https://community.unix.com/letter_avatar/newer/32/6_449c533f586939b6e5f246632a46421f.png) [@Newer](https://community.unix.com/u/Newer)\
**Post date:** [September 11, 2012, 2:07pm UTC](https://community.unix.com/t/crontab-script-sql/316525/3 "2012-09-11T14:07:13Z")

</div>

Hi Corona688.....  
I really don't understood anything you asked, but i'll try my best again, it's ok.  
I have on my power a file .sql this script a i need to execute in few days, but i need to use the crontab cause the person who will be checking my works right? so We have differences of schedule.  
Then i need to create a script that conect to data base, run this .sql script then  
disconect to the dababase, besides get the file SPOOL spv\_host\_cleanup.log and send it by mail.  
i guess the better idea it's create some script which do all of that.

---

<div class="post-metadata">

**Author:** ![vbe](https://community.unix.com/user_avatar/community.unix.com/vbe/32/266_2.png) [@vbe](https://community.unix.com/u/vbe)\
**Post date:** [September 12, 2012, 8:30am UTC](https://community.unix.com/t/crontab-script-sql/316525/4 "2012-09-12T08:30:57Z")

</div>

Have a look here:

> **[SQLPLUS Password Parameter file being used when logging in](https://www.unix.com/unix-for-dummies-questions-and-answers/199851-sqlplus-password-parameter-file-being-used-when-logging.html)**
>
> Good day to everyone. This is my first time posting and just barely above basic Unix training. I think i have search thoroughly to ensure my question hasn't already been posted. But on the off chance | The UNIX and Linux Forums

It is exactly what this piece does...(well need a bit of customizing... but the skeleton is there...)
