Tester si un poste client sur le reseau ?

Bonjour,

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 :

[code]#! /bin/sh
REPERTOIRE_SOURCE=“192.168.30.11::original/copie/chris/“
REPERTOIRE_DESTINATION=”/copie/chris/“
FICHIER=”/home/serveur/Rsync/fichier_ch.lst"
PASSWD=”/home/serveur/Rsync/srv_passwd/.rsync_passwd"
DATE=date +%d_%m_%Y_%H_%M

rsync -avz --stats --force --ignore-errors --exclude-from="$FICHIER" $REPERTOIRE_SOURCE --password-file=$PASSWD “$REPERTOIRE_DESTINATION”

exit[/code]
Mon client a pour IP : 192.168.30.11

Merci de votre aide

faire un ping ?

target=nomHost     # ou avec IP target=123.123.123.123
if ping -c 1 $target | grep -q '0 received';then
        echo "$target down!"
        exit 1
fi

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 :wink: (je le fais au nez hein)

Si on aime le code concis:

[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 :wink: (je le fais au nez hein)[/quote]

Non. Plutôt:

if ! ping -c 1 $target > /dev/null ;then echo "$target down!" exit 1 fi