I have a python script, uploaded on a web server which is up 24/7. I want to automate this script, so that it runs every hour automatically. Is this possible? I came across cron job stuff, but I am not familiar about how to achieve this. Any help or example would be helpful.
Share
Open up your cron job file with
the add this line
I would recommend using a bash script or something to check if the process is already running.
Edit
Type the command
crontab -ethen press enter. Your screen will go black with a bunch of~‘s off to the side. Pressiyou are now in insert mode. Type* 0 * * * /path/to/my/script, make sure this is the absolute path to your script. PressEsc, then type:xand press enter. That should save the cron file, that is also assuming thatviorvimis the default editor for your cron file.Side notes
Also make sure that your script is executable,
chmod 777 myscript.pyshould do the trick, however please familiarize yourself with chmod and permissions.Also make sure that you have your
#/python/version/to/useas the first line in your python file.