0

Is it possible to automate a code snippet with Python to be run for example every hour? If yes, how it is done?

This code is aimed to be run on Azure server.

5
  • 3
    windows scheduler or crontab is suitable for this kind of jobs Commented Oct 27, 2015 at 7:49
  • @VigneshKalai, thanks for that info. The aim is that the code should be run on server. Sorry that I forgot to add that into the question. Commented Oct 27, 2015 at 7:59
  • The Python interpreter is an executable, so you can schedule it to run at certain intervals or times the same way you would any other on your OS or within your environment. Commented Oct 27, 2015 at 7:59
  • @martineau thanks for your answer. It seems that since I need to run a code snippet on server, this is more server specific question. Commented Oct 27, 2015 at 8:08
  • With Azure, a Web Job "...can be deployed to a Web App to implement background processing. That can be invoked on a schedule, on demand or can run continuously". Commented Oct 27, 2015 at 15:24

1 Answer 1

1

According your comments, it seems that your application is hosted on Azure Web Apps. We can leverage web jobs to run background tasks on Azure Web Apps. General steps,

1,Compress your python script into a zip file

2,login on Azure management portal, click WEBJOBS tab in your website dashboard navigation.

3,Click Add to create a web job task, input a name, upload the zip file with your python script, and configure frequency of running the task. enter image description here

For more information, please refer to Run Background tasks with WebJobs on official site.

Sign up to request clarification or add additional context in comments.

1 Comment

Liu: Thanks for your answer. That solved the case :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.