TristanBrotherton/netcheck

Get the error: /usr/bin/env: ‘python’: No such file or directory

Closed this issue · 7 comments

klabog commented

After doing all steps you indicated to install on ./netcheck.sh I get the following error:

SpeedTest-CLI: Installed
Logging to: log/connection.log
************ Monitoring started at: Di 18 Apr 2023 16:47:39 CEST ************
CONNECTED LINK SPEED:
/usr/bin/env: ‘python’: No such file or directory

Then script hangs.
I'm using Ubuntu Jammy
Any idea?
Thanks, Klaus

If you don't want to edit scripts, install the python-is-python3 package - that sets up the redirection of 'python' to the 'python3' that's all that recent versions of Ubuntu have.

klabog commented

Thank you very much, that fixed the error message.

Nevertheless, I still have a problem, and I apologise if it is just a problem of understanding on my part.
When I start the script as a service, I get the following one-time output in the log file, which does not change any more:

$ cat log/connection.log
************ Monitoring started at: Fr 21 Apr 2023 16:26:15 CEST ************
CONNECTED LINK SPEED:
Ping: 34.877 ms
Download: 88.11 Mbit/s
Upload: 89.56 Mbit/s

This is certainly not intended and I conclude that the script does not do what it should.
"sudo systemctl status netcheck" results in the following output:

$ sudo systemctl status netcheck
● netcheck.service - Netcheck Service
Loaded: loaded (/etc/systemd/system/netcheck.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-04-21 16:26:14 CEST; 19s ago
Main PID: 19203 (netcheck.sh)
Tasks: 14 (limit: 1980)
Memory: 157.8M
CPU: 20.011s
CGroup: /system.slice/netcheck.service
├─19203 /bin/bash /home/klabog/netcheck/netcheck.sh
├─19211 python /home/klabog/netcheck/speedtest-cli.py --simple --secure
├─19212 sed "s/^/ /"
└─19213 tee -a log/connection.log

Apr 21 16:26:14 MotriRasp systemd[1]: Started Netcheck Service.
Apr 21 16:26:15 MotriRasp netcheck.sh[19203]: -----------------------------------------------------------------------------
Apr 21 16:26:15 MotriRasp netcheck.sh[19203]: SpeedTest-CLI: Installed
Apr 21 16:26:15 MotriRasp netcheck.sh[19203]: Logging to: log/connection.log
Apr 21 16:26:15 MotriRasp netcheck.sh[19203]: ************ Monitoring started at: Fr 21 Apr 2023 16:26:15 CEST ************
Apr 21 16:26:15 MotriRasp netcheck.sh[19210]: CONNECTED LINK SPEED:

Where can I find the config file?
Environment variable LDMHOME is set, ping and traceroute are installed.
What could be wrong?
Thanks in advice, Klaus

What config file are you referring too? Netcheck has no config file, it uses parameters when invoked. If netcheck is working as expected when you manually run it, I would suggest you follow a guide to setup a service on your system and start debugging it that way.

Hi Klaus, I am the author of netcheck, but I have no idea what that website is. All documentation is retained in this repository.

klabog commented

I give up, obviously I am not smart enough to get the script to run

That website is talking about a completely different script with the same name (and presumably similar purpose) written in Perl.

This script is written in Python, and by default when run from the command line, it prints / logs something like what you've said or what I get if I try it now:

`me@pc:~/netcheck$ ./netcheck.sh

SpeedTest-CLI: Installed
Logging to: log/connection.log
************ Monitoring started at: Mon 24 Apr 2023 23:01:31 BST ************
CONNECTED LINK SPEED:
Ping: 24.003 ms
Download: 78.74 Mbit/s
Upload: 20.49 Mbit/s

`

It will then print / log nothing else unless or until it thinks the network is down when it does one of its checks.

It will then print that and, if and when the network comes back up, print that along with how long it thinks the outage is.

In short, if it produces more output than that, it thinks there's been a problem.