I am trying to setup a cron job to run the garbage collector every 15 minutes on my session directory to clean up sessions that are beyond the expiration limit I set in php.ini, in one of my subdirectory locations. I have never used cron jobs before so I was wondering if someone could help me.
What I have so far is:
15 * * * * /home/yadda/something/etc
tiny 4. /bin/ed Choose 1-4 [1]: Make a new line at the bottom of this file and insert the following code. Of course, replace our example script with the command or script you wish to execute, but keep the */5 * * * * part as that is what tells cron to execute our job every 5 minutes. Exit this file and save changes.
It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week . 0 1 * * * - this means the cron will run always at 1 o'clock. * 1 * * * - this means the cron will run each minute when the hour is 1.
The following is an expression that will execute every 15 minutes:
0 0/15 * 1/1 * ? *
So your expression would be:
0 0/15 * 1/1 * ? * /home/yadda/something/etc
You may be interested in the cronmaker website.
If you're using anacron (ubuntu default), then the notation is simply */15 as in
*/15 * * * * /home/yadda/something/etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With