Rujikin
Rujikin

Reputation: 773

Writing a cron expression to execute every 15 minutes

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 

Upvotes: 7

Views: 44259

Answers (3)

Mr5o1
Mr5o1

Reputation: 1818

If you're using anacron (ubuntu default), then the notation is simply */15 as in

*/15 * * * * /home/yadda/something/etc

Upvotes: 2

Krunal Saija
Krunal Saija

Reputation: 229

Visit Cron Maker website if you are using Quartz opensource scheduler.

For every 15 Minute:

0 0/15 * 1/1 * ? *

For Every Day:

0 0 12 1/1 * ? *

Upvotes: 1

Ian R. O'Brien
Ian R. O'Brien

Reputation: 6920

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.

Upvotes: 13

Related Questions