R
R
Roman Semenov2021-05-20 22:21:28
Python
Roman Semenov, 2021-05-20 22:21:28

Why does Ubuntu randomly terminate a python script?

I recently ordered a virtual machine on hosting for a telegram bot. I keep noticing that at a random time ubuntu sends a welcome message (Welcome to ubuntu...), shutting down the bot. The script does not return any error. I tried to run the simplest program ("while True: print('work')"), but after a few hours the same thing happened to it. Reboot did not happen either, Ubuntu version: 18.04.5 LTS.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UberPool, 2021-05-20
@5Roman17

Most likely you just exit the ssh session and the bot turns off, you need the bot to work in the background. Use for example screen.
Open a new screen, start the bot, press ctrl ad (thus exiting the screen).
Done the bot works in the background.
Installation:
apt install screen
More about screen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question