Results 1 to 6 of 6

Thread: how to set cron job in cpanel 3 vps optimized

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    3
    cPanel/WHM Access Level

    Website Owner

    Default how to set cron job in cpanel 3 vps optimized

    hello,

    in the cpanel at "cron job" i set something like this for to delete the files in video folders every 5 min, but still not works

    0 0 * * * find /home/mysite.tld/public_html/videos -mmin +5 -exec rm {} \;


    i should to delete "-mmin +5" ? (i made already the time in a filed in "Common Settings)


    thankyou

  2. #2
    Member GIANT_CRAB's Avatar
    Join Date
    Mar 2012
    Posts
    62
    cPanel/WHM Access Level

    Root Administrator

    Default Re: how to set cron job in cpanel 3 vps optimized

    Hello,

    cPanel 3?

    Isn't the latest cPanel version 11?

    Never mind, ontopic:

    min, hour, days, weeks, months.

    so it should be:

    */5 * * * * find /home/user/public_html/videos -f exec rm {} \;

    I am not very sure about the last part so please correct me if I am wrong

    Notes:
    -f means file finding only.

    Hope it was helpful.

    Yours truly,
    GIANT_CRAB
    Support operator @ LoomHosts

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    3
    cPanel/WHM Access Level

    Website Owner

    Default Re: how to set cron job in cpanel 3 vps optimized

    it tell me "-" is a bad command.

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: how to set cron job in cpanel 3 vps optimized

    This would be the proper way to do it:

    Code:
    */5 * * * * find /home/user/public_html/videos -type f -exec rm -f {} \;
    The -f after "-exec rm" is a force flag and "type -f" tells it to just remove the files rather than directories. I am entirely against using rm in any type of way such as this. It would be better to move the files elsewhere and then remove them at a later date manually.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Registered User
    Join Date
    Jun 2012
    Posts
    3
    cPanel/WHM Access Level

    Website Owner

    Default Re: how to set cron job in cpanel 3 vps optimized

    mannually? i cannot... i have need of a cron job. why is dangerous?

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: how to set cron job in cpanel 3 vps optimized

    It is always dangerous to force remove files as you could miskey the path and destroy a directory or the system itself. We suggest moving files over removing files whenever possible.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Need to set max cron job limit
    By thewebhosting in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 05-15-2008, 03:33 AM
  2. Cpanel unable t set Cron job.
    By SACHIN in forum New User Questions
    Replies: 4
    Last Post: 10-10-2006, 05:45 AM
  3. How to set cron job through shell ?
    By billau in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 08-15-2004, 10:22 PM
  4. How to set cron job through shell ?
    By billau in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 07-17-2004, 05:10 PM
  5. Cron job not working when set up through CPanel?
    By avara in forum cPanel & WHM Discussions
    Replies: 13
    Last Post: 09-04-2002, 06:10 PM