V
V
Valentine2019-01-25 16:17:11
Python
Valentine, 2019-01-25 16:17:11

Bot for VK disconnects after a maximum of a day on VPS from Digital Ocean, how to fix it?

There is a bot written in Python 3.7, vk-api 11.3.0. Rented the cheapest VPS from Digital Ocean. I deployed a virtual environment on it, tried to start the bot, but after a while it turns off. There were several attempts to run the script as a daemon, I tried nohup and screen, nothing lasted for a long time. I set the task in cron to run after reboot. The script ran, but still died a day later. I don’t know what logs to throw off, so I’m not attaching anything yet.

UPD: before that, the bot was hosted on Heroku without any problems for half a year.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
F
Fixid, 2019-01-25
@Fixid

use supervisor auto
restart + console logs

B
Boris Syomov, 2019-01-25
@kotomyava

What exactly is he falling from? I would start by analyzing this moment.
For example, what's in screen after the application crashes?
On startup:
Systemd, which you probably already have, can monitor the application and restart when it crashes. Worth it and use it to launch. Moreover, it will allow, unlike the same screen, to automatically launch the application at system startup and log its output.

D
Dmitry Kuznetsov, 2019-01-25
@dima9595

First you need to understand the reason for shutting down the bot, find the exception, so to speak. To do this, connect the logs. I agree with @Fixid.
Debage, debug and debug again. And if you didn’t write the bot, then contact the developer. Or go straight to freelance.

U
Uno, 2019-01-25
@Noizefan

I think there was a different environment on heroku and now something is crashing. Write logs, try exceptions and soon find out what the problem is. The supervisor will help, but it's like a nasal spray - it only removes the symptoms, but does not treat the cause

P
Puma Thailand, 2019-01-25
@opium

What prevents you from seeing the error when he dies in the same screen?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question