1

Actually i want all unpublish nodes to be delete automatically whose created date is 2 days ago. I can write php script for that and also include that code in hook_cron api.

but i am confused that my site is set to be run cron after every 3 hours and i want that php script to be run after 24 hours. can i set specific cron time for specific job. i dont want change the site cron job time.

2

Set system cron to every 5 minutes, and use Elysia Cron to manage particular tasks:

Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.

  • [NEW IN 2.0] Set the timings and frequencies of each cron task (you can run some jobs every day at a specified hour, other only monthly and so on...). For each task you can simply choose between some frequently used options ("once a day", "once a month" ...), or use a powerful "linux crontab"-like syntax to set the accurate timings. You can even define your frequently used options to speed up site configuration.
0

I would suggest you to do it by including condition in your code whether to execute particular part or not in each run.

On first run enter time value in database then in each run check if current time and db time has difference of 24 hrs or more then only execute that part, otherwise just skip it.

Hope it works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.