Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jul 2006
Posts: 96
A
member
member
A Offline
Joined: Jul 2006
Posts: 96
Hi Rick,

Is there a way to execute any saved SQL custom commands by cron?

Thanks!

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
sure..

i do it all the time..

one way (of many) is to create a file.. yourqueries.sql

then setup the cron command to be something like

"mysql -uyourusername -pyourpassword dbname<yourqueries.sql"

smile

Joined: Jul 2006
Posts: 96
A
member
member
A Offline
Joined: Jul 2006
Posts: 96
Thanks! smile

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
one thing to remember is to terminate each query with a semi-colon ;

that is one thing that bit me when i was first trying it out..

i have a script that does that as a subset of other maintenance things like:

closing the board down temporarily by changing config.inc.php
optimizing ubbt_POSTS ubbt_TOPICS
archiving ubbt_POSTS table to ubbt_POSTS_ARCHIVE table for any 'old posts'
gziping all the changed tables..
re-opening the board
FTPing to my local HDD and rotating with backup name

the sky's the limit, really.. but you can then rest easier @ night if you know you have a backup.. especially if it is more than just one website that you have to maintain.. wink


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
After server reboot
by Morgan - 09/02/2026 8:27 AM
Email Settings
by Outdoorking - 05/13/2026 2:44 AM
Who's Online Now
0 members (), 166 guests, and 137 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)