#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Johannesburg, South Africa
    Posts
    10
    Rep 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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    16
    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

Similar Threads

  1. How 2 install MySQL and PHP3 on Linux 6.1
    By eduany in forum PHP Development
    Replies: 1
    Last Post: March 15th, 2000, 07:23 AM
  2. Replies: 1
    Last Post: July 17th, 1999, 04:10 PM
  3. Replies: 0
    Last Post: July 16th, 1999, 11:15 AM
  4. Replies: 0
    Last Post: July 16th, 1999, 11:08 AM

IMN logo majestic logo threadwatch logo seochat tools logo