Cron Question

Discussion in 'PHP' started by wendallb, Jul 4, 2007.

  1. #1
    I have regular cpanel hosting and I need a cronjob or a small program to dump the main mail inbox every day. I know there is a cron for this but don't know how to code it.

    Help appreciated.
     
    wendallb, Jul 4, 2007 IP
  2. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #2
    try something along the lines of this. this will run every 12 hours but you can change it rather easily. didnt know how often you wanted to perform the action :)

    
     0 */12 * * * /home/user/maildump.php > /dev/null 2>&1
    
    Code (markup):
    /dev/null is pretty much the garbage collecter. so output there and you shouldn't have to worry about anything.
     
    ansi, Jul 4, 2007 IP
  3. wendallb

    wendallb Active Member

    Messages:
    180
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Ansi thanks, I will give this a try.

    All the Best,
     
    wendallb, Jul 4, 2007 IP
  4. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #4
    Or you can also use this formatting for cron to execute phps ;-)
     
    killerj, Jul 6, 2007 IP
    ansi likes this.
  5. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #5
    whoops. yeah that would be a good idea. didnt think about that. haven't done any work running php through cron but he's right. you need to use php -q to execute it.

    
    0 */12 * * * php -q /home/user/maildump.php > /dev/null 2>&1
    
    Code (markup):
     
    ansi, Jul 6, 2007 IP