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
2009/10/25 Niki Kovacs contact@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 a écrit :
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.
This looks interesting, and I will take a closer look.
I'm right now knee-deep in this :
http://www.mikerubel.org/computers/rsync_snapshots/index.html
I'm adapting it to my environment, and it already works great.
Cheers,
Niki
Niki Kovacs wrote:
Les Mikesell a écrit :
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.
This looks interesting, and I will take a closer look.
I'm right now knee-deep in this :
http://www.mikerubel.org/computers/rsync_snapshots/index.html
I'm adapting it to my environment, and it already works great.
The big win with backuppc is that it will also compress the files and find matches across multiple machines and hard-link all identical content. Plus you get a nice web interface to configure it and browse/restore.
Les Mikesell a écrit :
The big win with backuppc is that it will also compress the files and find matches across multiple machines and hard-link all identical content. Plus you get a nice web interface to configure it and browse/restore.
Sound nice. Probably a case of: now I found a solution with a long and complicated Bash script, I may as well use the nifty little app that did it nicely beforehand :o)
Cheers,
Niki
Niki Kovacs wrote:
Les Mikesell a écrit :
The big win with backuppc is that it will also compress the files and find matches across multiple machines and hard-link all identical content. Plus you get a nice web interface to configure it and browse/restore.
Sound nice. Probably a case of: now I found a solution with a long and complicated Bash script, I may as well use the nifty little app that did it nicely beforehand :o)
Backuppc is all perl - including a reimplementation of rsync that knows how to work with compressed local files while chatting with a stock remote version. But the way I look at it is that the complexity is irrelevant as long as someone else already did the work and it is well tested.
The ping method or equivalent mechanisms (such as a test ssh into the machine) should answer the original question.
However, in the specific context of backups, a few years ago I did for a client an evalution of various backup solutions, including a lot of freeware and commercial products (including some high end and expensive ones). I was completely dismayed with what was available at the time other than at the top end; products were either missing features that I'd consider necessary for enterprise deployments, or had the features but lacked stability.
However, about a year or two after that Bacula came out (www.bacula.org) and I've been extreamly impressed with it. This open source solution is (IMO) at least as good as any of the commercial ones out there, including the top end backup products. It's very stable, has a fantastic feature set, fantastic response from the developers, and commercial support is available for those companies wanting it.
And getting back to point, while its normal mode of operation is to back up machines that are on the net 24/7, it can also be configured to back up machines (like my laptop) that aren't always there. By default an unreachable client would be considered an error condition, but bacula can be set up so that it just reschedules the client for the next available backup window.
Devin