J’ai un script rsync sur serveur qui se synchronise avec un client, j’aimerai que celui-ci test si le client en question est présent sur le reseau, comment je rajoute ceci ? :
mon script rsync :
target=nomHost # ou avec IP target=123.123.123.123
if ping -c 1 $target > /dev/null ;then
echo "$target down!"
exit 1
fi
Je pense que ça suffit (je le fais au nez hein)
[quote=“MisterFreez”]target=nomHost # ou avec IP target=123.123.123.123
if ping -c 1 $target > /dev/null ;then
echo "$target down!"
exit 1
fi
Je pense que ça suffit (je le fais au nez hein)[/quote]
Non. Plutôt:
if ! ping -c 1 $target > /dev/null ;then
echo "$target down!"
exit 1
fi