#Restart Shell

1 messages · Page 1 of 1 (latest)

worn escarp
#

Hello. I am running a bot that (I try to) runs 24/7.

It constantly edit a message with some live data and a graph made with matplolib.

The bot always stop with the message Restart: Shell after a couple of hours.

Any idea how to fix this and make the bot rly run 24/7?

brave flame
raw perch
worn escarp
#

My pc is on 24/7

#

It's the script that stops randomly

#

No error at all. It just says "Restart shell" like in the picture

knotty cape
#

You could write a simple python forever script

#

that would just reboot the bot if it exists.

worn escarp
#

A script for starting the script again?

knotty cape
#
from subprocess import Popen
import sys

filename = sys.argv[1]
while True:
    print("\nStarting " + filename)
    p = Popen("python " + filename, shell=True)
    p.wait()
#

insteead of using python start.py

#

you would run python forever.py start.py

worn escarp
#

Yeah. Can use this temporarly. But it's just hiding a bug/Mistake

knotty cape
#

the restart shell btw, is when you are using the python shell to execute your programs

#

it's not built for executing longer duration stuff

worn escarp
#

Ohhhh

#

This might be the issue.

#

What would you recommend for running a program 24/7

knotty cape
#

literally any other shell/command prompt