scheduled tasks - Python script to send mail at specific time and day every month -


i want send mail every 2nd friday in month @ 4:00 p.m. how in python. know following logic not efficient, is there other way in python?

// pseudocode check 2nd friday , time 4:00 p.m.

function(day='fri',time='4:00 p.m.') while(1){     string current_date=new date();// in following formate.    // fri aug 21 2015 16:00:00 gmt+0530 (ist).     // here can see combination of date, day , time.    //now current_date string search sub string 'fri'   if(current_date.substring('fri') && current_date.substring('16:00:00')){       // search date 2nd friday or not,       int day=current_date.getday();       if(day>7 && day<=13)          start_script send mail   } } 

you can use celery periodic tasks automate this. @ here http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html

celery handle cron in behalf , provide number of additional tools such login , interfaces should make script scalable (to more users, tasks, etc.)


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -