MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2000, 11:37 AM
tonyds tonyds is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: Johannesburg, South Africa
Posts: 10 tonyds User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi All,

I have a database that has to automatically on a daily basis check for certain things - add things to tables - and mail certain people according to results of the action. If one creates a PHP3 page to do these actions it works - but can those procedures be done by running a CRON job daily - would one run the .php3 page - or use some kind of MySQL command ?

Hope you can help.

Reply With Quote
  #2  
Old February 18th, 2000, 03:02 PM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Yep, you can use cronjobs to run shell or Perl scripts for daily/weekly/monthly maintenance. Sometimes I use a batch file/sql file pair to clean up stuff...

Example
##############
# file1.batch
##############
use db_name;

# clean out stuff older than two weeks and
# run once a day

delete from table_name where to_days(now()) - to_days(date_field) > 14;

##############
# file1.sql
##############
mysql -t -u username -ppassword < file1.batch

# no spaces between -p and password
# downside of this is that password is hard-
# coded into the file but its quick and dirty

Then run ./file1.sql from the command line or set up a cronjob to execute file1.sql whenever you want. Also works great with perl scripts, especially for MAIL functions, provided you have DBI set up and all that

Kyuzo

Nou ga aru taka wa tsume o kakusu

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > CRON + Mysql / PHP3

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap