python - How do I run a script on friday, once every two weeks? -


i use cron, can't figure out if there's way set right schedule. can check date in python, running script via cron everyday, checking right date inside (python) script (which assume has more powerful conditions).

i thought on limiting 1 run on fridays between 1 , 7, , other 1 on fridays between 15 , 21. option have problem on months 3/2013 have 5 fridays.

is you're looking for?

put in crontab:

0 7 * * 5 sh -c " if [ $(expr $(expr $(date +\%s) \/ 604800) \% 2) -eq 0 ]; command; fi " 

this run command every other friday @ 7.00 am.

note: number 604800 means 1 week (3600sec * 24 * 7).


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -