Запустил python процесс для бота телеграм.
и он раз в день крашится (процесс завершается) из-за разных ошибок, например:
File "main_bot.py", line 67, in <module>
bot.polling(none_stop=True, interval=0)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 192, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 215, in __threaded_polling
polling_thread.raise_exceptions()
File "/usr/local/lib/python2.7/dist-packages/telebot/util.py", line 73, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/usr/local/lib/python2.7/dist-packages/telebot/util.py", line 54, in run
task(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 122, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 92, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 139, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 34, in _make_request
result = requests.request(method, request_url, params=params, files=files, timeout=(connect_timeout, read_timeout))
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 49, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 407, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(101, 'Network is unreachable'))
Можно ли сделать так, чтобы py демон не завершался, либо запускать его автоматически если он вылетит?
Бот запускаю на VPS с Debian так :
bot.polling(none_stop=True, interval=0)
Использую
pyTelegramBotAPI