|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CHECK TABLE cron job needed
Hey all,
This is my first post here, so go easy on me :-) I am looking to run a nightly cron job that will run a CHECK TABLE on a given mysql database, then repair if necessary. Keep in mind that the database is not on the same server that would be running the cron. I'd rather keep this a system level thing and not have to excecute a PHP file if possible. |
|
#2
|
|||
|
|||
|
RE: CHECK TABLE cron job needed
You can use BASH + Cron...
|
|
#3
|
|||
|
|||
|
RE: CHECK TABLE cron job needed
you can call the mysql executable and have it run any sql script you choose.....
|
|
#4
|
|||
|
|||
|
RE: CHECK TABLE cron job needed
i know you didn't want to include the php, but i think that if you are already good with php, the best way is to do it like this.
on a machine where you have a cron, set up a wget crong job to "start" your php script remotly. do all your logic in that php file placed on that other server, and you are done... |
|
#5
|
|||
|
|||
|
RE: CHECK TABLE cron job needed
Jorgen & Matt: I figured that, but I am not strong with BASH. Since there are new tables being added to my database all the time, how can I build up a list of the tables to check? I have created a small bash script that connects to the database and runs CHECK TABLE queries in a file called queries.sql, but I had to create that file manually to include all the table names.
Zombie: I was able to create this in PHP no problem, however, as I said I kind of wanted to stay away from PHP for this process. No real reason I suppose other than I would like to learn to do it with BASH. |
|
#6
|
||||
|
||||
|
RE: CHECK TABLE cron job needed
To see all the tables in a database:
Code:
SHOW TABLES FROM `db_name` |
|
#7
|
|||
|
|||
|
RE: CHECK TABLE cron job needed
honcho: thanks, but that will just display the list correct?
I really need to be able to capture that list into an array or something then iterate through it with a check and repair. I can do this fine in PHP, but as I said, I am not too strong in BASH. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > CHECK TABLE cron job needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|