Setting Cron job to delete file after 24 hours

前端 未结 4 1551
再見小時候
再見小時候 2021-02-10 09:22

I read all the related questions and was unable to understand them. I am using Plesk CPanel to set cron job as it was advised by everyone.

I want to delete all files fro

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-10 09:58

    If you have access to your Server or SSH, you can simply add it to your crontab.

    In your SSH just type

    crontab -e
    

    you will see a list of cron jobs on it, just append this line of code to your cronjob:

    0 10 * * * rm -rf /var/www/example.com/public/js/compiled/*
    

    The code above means that every 10am in the morning you are removing all the files in the path you provide. Please refer to this link for more info about Cron: http://en.wikipedia.org/wiki/Cron

提交回复
热议问题