Recently, I developed a Python script that runs on a GCP VM. This script takes user input and generates the corresponding output based on that input.
When I attempted to run it on a GCP VM, it executed without any problems, and the script performed perfect. However, after a couple of hours, the script completely goes down.
Additionally, I used python anywhere to run the script. but, it has a resources limitation.
I generally run it like python3 script.py
you can run a systemd job with it and use a timer to define when and and how often it should run. https://wiki.ubuntuusers.de/systemd/Timer_Units/
Well, with user input it makes it more complicate, but maybe you find you solution here: https://unix.stackexchange.com/questions/453998/systemd-connect-to-stdin-stdout-after-service-has-started
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With