You'll need to write some logic to check the current date/time, against a value you store the last time your cron job ran. That logic isn't Drupal-specific (just basic PHP) so we can't help you with it here; but you'll probably want to use variable_get/variable_set to store/retrieve your timestamp
–
Clive♦Feb 18 '14 at 10:05

3 Answers
3

You can easly do this without having access to crontab/shell, by using following code in your cron_hook:

// check if current day is 10th and month is an even number
if (date('d')==10 && date('m') % 2 == 0) {
// get todays-date (format: yyyymmdd)
$today = date('Ymd');
// get info about last run
$last_run = variable_get('my_last_run', 0);
// check last run was not today
if ($last_run!=$today) {
// set last run to today
variable_set('my_last_run', $today);
/* Place your code here */
}
}

@shyghar , do u have process that execute every second and check your condtions?!!!!!!!!!!! , This is not correct way ,if you think it work in php , I tell you are mistakes, because php not run any function any second to check your condition available,if you put it in default drupal raw, it run when only cron run .by the way this is completely mistake method !!!!
–
zhilevanFeb 20 '14 at 3:52

Nope.. I inserted this code in a hook_cron() so this code will be executed only with mt drupal cron [once a day]..
–
ShygharFeb 20 '14 at 10:44

The best way is use crontab ,create a php file as example mycorn.php trigger your rule in it and create a crontab to run your php file every 2 month.
Just one note, please set permission only owner can execute it.