You are not logged in.
Right now i'm using the following:
while ! ping 192.168.117.28 -c 1 -w 1 &>/dev/null ; do sleep 0.5 ; done
I need it to be reactive, so i just set a timeout of 1 second and a sleep of 1/2 second, but this involves calling "ping" executable too often!
I wonder if there is a tool that exits as soon as the host stops answering, ping options dont seems to help.
Thanks!
Last edited by kokoko3k (2018-04-18 09:30:14)
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline
With perl you can do this:
#!/usr/bin/perl
my ($host, $timeout, $family) = @ARGV;
use Net::Ping;
$p = Net::Ping->new();
while ( $p->ping($host, $timeout, $family) ) {
select(undef, undef, undef, 0.25);
}
$p->close();
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Almost no cpu use with:
./wait.down.pl 192.168.117.28 0.1
Thanks!
-EDIT
It seems to work, but just to be sure, is the following edit sufficient to invert the logic and wait for the host to be up too?
while ( ! $p->ping($host, $timeout, $family) ) {
Last edited by kokoko3k (2018-04-18 09:33:19)
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline
That should work.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline