S
S
svd712015-04-10 12:37:39
linux
svd71, 2015-04-10 12:37:39

In linux how to check the activity of a computer on the network in a script?

It is required to create a script in which it is necessary to check the presence of a computer on the network.
All kinds of thoughts come to mind:

$>ping -c 1 192.168.1.1|grep "1 received">/tmp/networkcheck.txt

Everything is fine, the file is created. If there is no ping, then it is empty, with some amount of ping. But the check for file size itself takes a decent amount of code.
In general, how is it more correct to organize such checks in the shell?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
ldv, 2015-04-10
@svd71

ping 192.168.1.1 -c 1 && echo Host is up

N
Naker, 2015-04-23
@Naker

nmap -n -sP 192.168.1.1 | grep -c "1 host up"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question