The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cron job help

Discussion in 'General Discussion' started by mher, Jul 10, 2006.

  1. mher

    mher Well-Known Member

    Joined:
    Jun 14, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Hello, how can i create a cron job that runs every five minutes and does this:
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    Create a file say, 'deltempfiles' under any directory and insert the following lines :-

    #!/bin/bash

    cd /tmp;
    rm -f p*.*;

    Save the file and chmod it to 755.

    Edit the cron file for root at /var/spool/cron/root or just do crontab -e

    and set the cron as :-

    5 * * * * /Path/to/deltempfiles

    Save the file and restart cron service :- service crond restart
     
Loading...

Share This Page