How can I run a cron job for every 2 or 5 seconds.

Hey, I have a script which checks twitter for any new tweet with a particular hashtag. I want to run that script for like every second or atleast 5 seconds through cron job. Is that possible through pythonanywhere? If yes? then how?

Regards, pruthvi

Probably the best way to do this is to have a constantly-running task with a check-sleep-check-sleep kind of loop. This page gives a useful way to write a long-running task like that in a way that means it's restarted if it ever crashes.

Hi I am looking at running a task monthly (12:00 on the 15th of every month). What would you suggest seeing that tasks can only do Daily or Hourly?

The easiest way to do that would be to scheduled it to run at 12:00 every day, and then at the start of the script, check the date and exit immediately if it's not the 15th. Something like this:

from datetime import datetime
import sys

if != 15: