topkecleon / telegram-bot-bash

Telegram bot written in bash
Other
426 stars 123 forks source link

get-updates does not get updates after some time #158

Closed RandomUsN closed 3 years ago

RandomUsN commented 3 years ago

After starting the bot, it does not work all the time. It stops processing commands after 1-2 minutes, but the process is active. Please check and let me know how I can fix this.

root@test:/home/utest/telegram-bot-bash# ps aux | grep bot root 2512 0.0 0.0 6080 884 pts/1 S+ 22:02 0:00 grep bot root 21710 0.0 0.4 9772 4640 pts/0 S 20:59 0:00 /bin/bash ./bashbot.sh startbot BOT_bot-startbot

root@test:/home/utest/telegram-bot-bash# ./bashbot.sh status Bot is running with UID root.

Screenshot from 2020-11-25 00 44 26

gnadelwartz commented 3 years ago

did you run bashbot.sh init? are the commands and possible errors shown in the log files?

to get also bash error messages in debuglog run bashbot in debug mode https://github.com/topkecleon/telegram-bot-bash/blob/master/doc/7_develop.md

RandomUsN commented 3 years ago

Yes, run bashbot.sh init. I started the bot with debug: ./bashbot.sh start debug

The log file logs/DEBUG.log now contains records about several of my messages, but after 2 minutes they are no longer written to the log, only getUpdates: ... Sat Nov 28 09:57:16 UTC 2020: getJson (wget) URL=getUpdates?offset=1 Sat Nov 28 09:57:16 UTC 2020: getJson (wget) URL=getUpdates?offset=340212372 Sat Nov 28 09:57:17 UTC 2020: getJson (wget) URL=getUpdates?offset=1 ... Sat Nov 28 09:58:38 UTC 2020: getJson (wget) URL=getUpdates?offset=1 Sat Nov 28 09:58:38 UTC 2020: getJson (wget) URL=getUpdates?offset=340212373 Sat Nov 28 09:58:39 UTC 2020: getJson (wget) URL=getUpdates?offset=1 ... Sat Nov 28 10:19:17 UTC 2020: getJson (wget) URL=getUpdates?offset=1

Screenshot from 2020-11-28 13 08 48

gnadelwartz commented 3 years ago

ok, I see bashbot is using wget, did you configure it this way? if not, bashbot does not find curl or curl is not installed

gnadelwartz commented 3 years ago

in case you have installed curl, what's the output of:

type -t curl
which curl
RandomUsN commented 3 years ago

I didn't have installed curl. I installed it.

curl --version

curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1c zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3 Release-Date: 2019-02-06 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

type -t curl

file

which curl

/usr/bin/curl

The logs/DEBUG.log stopped writing records about wget, but the situation did not change.

Sat Nov 28 13:26:41 UTC 2020: debug_checks: start SOURCE=no: bashbot.sh start debug: debug_checks: : bashbot.sh Sat Nov 28 13:26:41 UTC 2020: debug_checks: start SOURCE=no: bashbot.sh startbot debug: debug_checks: BOT_bot-startbot: bashbot.sh Sat Nov 28 13:26:41 UTC 2020: Start BASHBOT updates in Mode "debug" ========== Sat Nov 28 13:26:42 UTC 2020: debug_checks: end start: bashbot.sh start debug: debug_checks: : bashbot.sh

gnadelwartz commented 3 years ago

ok, so it's not wget related ... hm ...

gnadelwartz commented 3 years ago

as curl wasn't installed, is iconv installed? this is not mentioned as prerequisite but used in the get_updates loop ...

RandomUsN commented 3 years ago

Yes, iconv installed:

iconv --version

iconv (Debian GLIBC 2.28-10) 2.28 Copyright (C) 2018 Free Software Foundation, Inc.

gnadelwartz commented 3 years ago

ok, on Ubuntu it's working, I have to try a Debian installation.

gnadelwartz commented 3 years ago

pls try if the dev version version for 1.2 fix your problem https://github.com/topkecleon/telegram-bot-bash/releases/tag/v1.2-dev

use the v1.2-dev files for installation/update, see https://github.com/topkecleon/telegram-bot-bash/blob/master/doc/0_install.md

RandomUsN commented 3 years ago

I downloaded and checked dev version 1.2, but the problem is not fixed. grep "VERSION" README.md

$$VERSION$$ v1.1-0-ge835bbc

gnadelwartz commented 3 years ago

bashbot is running several hours on my virtual debian, so far no problems

did you run bashbot with "./bashbot.sh startbot" in the terminal or did you try to run it with "bashbot.rc" example script in background??

RandomUsN commented 3 years ago

I only started bashbot with ./bashbot.sh start and ./bashbot.sh start debug. I expected this to be enough. Do I need to do this with "bashbot.rc"? Process is active:

/bin/bash ./bashbot.sh startbot debug BOT_bot-startbot

gnadelwartz commented 3 years ago

OK, no this is corrrect, will the bot also stop working if you use the undocumented startbot command? In this case the bot will not be disconnected from terminal ...

./bashbot.sh startbot

gnadelwartz commented 3 years ago

I testet it in a fresh VM with Debian Buster and tried it several times, but can not reproduce your problem, it was working in all cases.

PSX_20201129_164037

If you know bash well, you can set log level to debugx then every executed bash command is logged to DEBUG.log. May be you can find the offending problem there ...

For now I set the issue to invalid, as I can't reproduce it.

RandomUsN commented 3 years ago

I created a new bot in telegram and the bashbot works with it correctly.