I have a python program in glitch. It keeps running automatically forever and I do not want it to run. Is there a way to stop glitch from running my program and that it is run only when I want it to?


#1

I have a python program in glitch. It keeps running automatically forever and I do not want it to run. Is there a way to stop glitch from running my program and that it is run only when I want it to?

I would call this program from uptimeRobot or even use a cron job that will run this program once every hour, but for the 5 minutes glitch is up, this one keep running messing up all my data unfortunately. :frowning:


#2

Hey @venkysridh, welcome to the Glitch forum!

To clarify, you’d like your project’s code to run once and only on demand, is that correct?

This is a little counter to the generally expected behavior of Glitch projects, so it’s not directly supported. Even if you were to set things up so that your project only ran once when it was started, anytime anyone anywhere on the internet loaded your project’s url it would start and run your code.

What you could do would be to place the code you want to run only on demand behind a particularly obscure route, and set your project’s homepage to just return 200 or something like that. Then you could point UptimeRobot at your custom route and the code you’re interested in running on-demand would only run when UR hit your special url.

Does that sound like it might work?