I created a vm
in google cloud to run a script (bot) but every time I close my terminal the script is interrupted for no apparent reason.
The code itself has a while True
with a conditional in the middle to create a delay;
while True:
time.sleep(30)
# do stuff
To run the script I use hohup
through the cloud console provided by google
;
nohup python3 script.py &
This command generates a nohup.out
file that stores the generated logs, even after executing the command no data is entered in nohup.out
but the script starts successfully.
How do I run a script in a google cloud VM forever?