Q:

How to set cron job for every 45 days

I want to send an email after every 45 days using cron job. Since, i have already made php
script for email. So i want to execute it after every 45 days. Can you help me for this?

A:

The script can be run daily and wrapped to check if the number of days modulo 45 equals to a constant:
10 13 * * *  test $(( `date +\%s`/24/60/60\%45 )) = 41 && your_script

I assumed 41 so the expression would evaluate to true today on 2012-01-12. Percent '%' is special character in crontab, it needs to be escaped.

A:

From Crontab site 
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

There is not really anything here that will do "every 45 days" 
I would run your script once a day and have your script check if it has been 45 days since you last sent mail.
<?php
    if($days_since_last_email >= 45) {
        //your existing send mail script here
    }
?>

A:

Same can be implemented by scheduling 2 cron jobs for the script
Starting from 01-Jan-17:
0 0 1 1,4,7,10 *  abc.sh

0 0 15 2,5,8,11 *   abc.sh

