ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Im trying to do something very similar. I wrote a script that returns the ping time if it gets a reply, and NULL if ping times out. My problem is that if i dont get a reply the script takes about 10 seconds to time out. Im making this script for a status page of a wireless lan with about 200 units so u see why this is a problem.
Any ideas??
Did u get the script to work??
Ill post the script when i get home from work if u're interested.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I have done the same to see if my internet connections are up or not. The script is written in Bash.
The timeout problem can be solved by specifying the -w or -W ping option. Maybe not necessary in your application of detecting wireless clients, but usually I recommend to check more than one ping reply using the count option. If there are routers or Cisco managed bridges in between your hosts the first ping might fail.
I think it's cause I use debian. Ping in debian doesn't have -w.
I wouldn't know(i'm a ) but someone told me so.
I think there is something called fping with more options.
Anyway here's the code:
I tried that but the -w parameter just isn't there. Maybe it's the version or something. I got our admin to install fping on the server. He should be done later today. I'll let u know how it went.
The shell_exec command i used is just the last desperate try in an endless line of tries. And i think the one u're using was the first one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.