SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Cron Jobs

  1. #1
    SitePoint Member
    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cron Jobs

    i want to write a php mailing script in which i can send a mail 3 times in 3 days(1 mail in 1 day) automatically.
    i think it can be done by Cron Jobs. But i don't have any idea about Cron jobs. Please tell me how will i do this?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,127
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    To put it simply, program your e-mail script in PHP like you normally would. Then instead of accessing it from a web browser, use SSH to login to your host account and run it from the command line
    Code:
    php5 /path/to/your/script.php
    If it runs without any errors, then you can setup this command in a cron job (this will run every day of the week, every month, every day of the month at 00:00 midnight; so you will need to remove this cronjob at after 3 days) http://en.wikipedia.org/wiki/Cron
    Code:
    0 0 * * * php5 /path/to/your/script.php

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    (or you could make it 0 0 1,2,3 6 * and only do it the 1st, 2nd, and3rd of June, and then you would only need to remove it sometime in the next year.)

    Be careful doing this though. This is a good way to get your account terminated if your mail is classified as spam.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  4. #4
    SitePoint Member
    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks ..

  5. #5
    SitePoint Member
    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How will i create time based trigger in mysql.

  6. #6
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Maui, HI
    Posts
    211
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •