Forums

Ping command not working from Always On Task

Hi! Please help. I have a Telegram Bot, when i start him from Bash Console - it works fine but once a day stops working. I tried to use Always on task but in log file receive 'ping operation not permitted'. I have 5USD account, what can i do?

Thanks!

2023-01-12 08:55:34 - Task preparing to start Jan 12 09:00:58 ping: socket: Operation not permitted Jan 12 09:01:58 ping: socket: Operation not permitted Jan 12 09:02:58 ping: socket: Operation not permitted Jan 12 09:03:58 ping: socket: Operation not permitted Jan 12 09:04:58 ping: socket: Operation not permitted

That is what i receive in Task Logs

--- 176.102.48.100 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms PING 176.102.48.100 (176.102.48.100) 56(84) bytes of data. --- 176.102.48.100 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms PING 176.102.48.100 (176.102.48.100) 56(84) bytes of data. --- 176.102.48.100 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms

This how it works in Bush Console

Thanks for reporting that -- it seems there's a bug in the always-on tasks preventing ping to work, we'll have to investigate that (but we can't prioritize that ticket now, unfortunately).

Thanks. Will wait for Updates

Hi! Any updates?

No, we do not have an update.

Hi team, any news? It is not convenient to restart the bot every day, because the console stops and restarts

No updates yet. It will probably not be an easy fix, so we don't have any ETA on this.

Same Problem please, if you can not solve the bug, provide a solution so that we do not have to restart the bot every day. Thanks in advance

@BananaBoss could you explain why you're using ping?

In Ukraine are constant blackouts due to the war, the bot informs Ukrainians about the presence of electricity at home

Perhaps you can use an http request the check the host instead?

How can I check the availability of a remote router use an http request?

Could you give an example of what you are checking?

ping 176.102.48.100

the bot checks the availability of wifi routers in different areas

Unfortunately I don't think there is a solution if the routers don't provide some kind of http interface; do you get any response at all if you do (say) a requests.get to the IP?

I do not think that we can replace the ping with something...

We can't do anything quickly about ping in the alwayson tasks and consoles are ephemeral by design.

Hi! any news?

Hi, I also have an issue with a telepot script. When I start my bot from the console, it works fine, but when I start it from "Always on tasks", I get this error (followed by many follow-up errors).

Feb 21 10:15:17 Traceback (most recent call last): 
Feb 21 10:15:17   File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn 
Feb 21 10:15:17     conn = connection.create_connection( 
Feb 21 10:15:17   File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 72, in create_connection 
Feb 21 10:15:17     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 
Feb 21 10:15:17   File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo 
Feb 21 10:15:17     for res in _socket.getaddrinfo(host, port, family, type, proto, flags): 
Feb 21 10:15:17 socket.gaierror: [Errno -2] Name or service not known

Could that have something to do with the same issue, or should I open a new thread? Thanks!

@DenysKryvulskyi - no there is no news.

@uioplmn - That just looks like you're trying to access a site that does not exist. Is there no more information in the traceback?

@glenn If that was the case, it would also happen when I start the bot from the console, right? I created a new thread, so that we don't have to occupy this here thread. Should we head over? https://www.pythonanywhere.com/forums/topic/32498/#id_post_109959

Thanks, I've replied there (actually, I saw the other thread first).