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.

removing files thru cron

Discussion in 'General Discussion' started by smile, Sep 27, 2005.

  1. smile

    smile Well-Known Member

    Joined:
    Oct 2, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    My potential client asked if he could remove the files on his shared hosting account using the following cron

    1 * * * * rm /home/hosting/public_html/dailylog/*

    Can rm command work on shared hosting account ?
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Well, you could, but one has to ask why - surely fixing whatever application is generating the files would be best.

    Either way, you should really use the -f qualifier on the command:

    1 * * * * rm -f /home/hosting/public_html/dailylog/*

    Are you aware that that will run rm 1 minute past each hour?
     
  3. smile

    smile Well-Known Member

    Joined:
    Oct 2, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    0
    Hi Chirpy,

    Thanks a ton !!

    Client just asked and I was not sure of this...may be I'll ask him to modify the interval to execute the job
     
Loading...

Share This Page