Hi, I'd like to test the status of a remote machine in a script. Something like: IF remote machine is switched on / connected to the network... ... THEN launch backup. How would you go about that? Cheers, Niki
Benjamin Donnachie
2009-Oct-25 11:30 UTC
[CentOS] Testing remote machine status in a script ?
2009/10/25 Niki Kovacs <contact at kikinovak.net>:> IF remote machine is switched on / connected to the network...Use ping and test the result; perhaps something similar to this: case `ping -qnc 1 10.0.0.2 2>&1` in *'100% packet loss'*) exit 1 ;; esac See the script at the bottom of http://www.digitalpeer.com/id/configuringa for more info. Ben
Niki Kovacs wrote:> Hi, > > I'd like to test the status of a remote machine in a script. Something like: > > IF remote machine is switched on / connected to the network... > > ... THEN launch backup. > > How would you go about that?I always recommend backuppc (either from http://backuppc.sourceforge.net/ or the package in epel) because it does all this for you and gets it right. -- Les Mikesell lesmikesell at gmail.com