Set up scheduling

We're going to make a shell script which PythonAnywhere will execute on a schedule. A free account is only allowed to run one scheduled task per day, but if you want to tweet more than that you can get unlimited scheduled tasks for about $5 per month on PythonAnywhere or other hosting services like Digital Ocean. You can read more about choosing and configuring hosting at BotWiki.

For our free once per day bot,

  • Add a file called to the hello-world-bot directory with the following contents:
    cd /home/$USER/hello-world-bot/
  • On the bash console, make sure you're in the hello-world-bot directory and run
    chmod +x
    This will give PythonAnywhere permission to run the script.
  • Visit the "Schedule" tab on PythonAnywhere
  • Add a new scheduled task which points to /home/[your username]/hello-world-bot/ and runs within the next couple of minutes. Note that the system time is in the UTC timezone, which may not be the same as your own timezone!
  • You'll be able to tell if the scheduled task is working correctly if a tweet is posted at the time you configured it for. If something went wrong, you can remove the task and set it up again with a different time.

results matching ""

    No results matching ""