Hallo, es ist vielleicht etwas OT aber ich hab mal eine Frage zum ping. In der Manpage steht das ping 3 Errorcodes liefert. 1 u 2 bei Fehler, 0 ist i.O., Wie kann ich diese in einem Shellscript unterbringen ? Hintergrund: ich brauche ein script, welches per ping, die Namensaufloesung und das Vorhandensein eines ftp servers checkt, wenn alles i.O. wird ein upload durgefuehrt, wenn nicht wird dieser Schritt ueber- sprungen. Hat jemand eine Idee ? tom Thomas Koenig (Benutzerservice DRESDNER BANK) * email: Thomas.Koenig-@Dresdner-Bank.com * Voice: +49 361 242 - 8670 * Fax: denkste :-) -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
On Mon, 11 Jan 1999, Koenig, Thomas wrote:
Hallo, es ist vielleicht etwas OT aber ich hab mal eine Frage zum ping. In der Manpage steht das ping 3 Errorcodes liefert. 1 u 2 bei Fehler, 0 ist i.O., Wie kann ich diese in einem Shellscript unterbringen ?
Hintergrund: ich brauche ein script, welches per ping, die Namensaufloesung und das Vorhandensein eines ftp servers checkt, wenn alles i.O. wird ein upload durgefuehrt, wenn nicht wird dieser Schritt ueber- sprungen. Vielleicht so:
Durch Verwendung der shell-Variable $? man bash => /\? ? Expands to the status of the most recently executed foreground pipeline. ping -c 5 ftpserver &>/dev/null if [ $? -eq 0 ] then action1; action2 elif [ ] then ... else ... fi hier kann dir die online-hilfe zur bash weiterhelfen: help if help [ help test | less Viel Spaß! /Axel Axel Franke Combustion Physics Lund Institute of Technology / Sweden Phone +46-46-22-20353 Fax +46-46-22-24542 -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
Hi, On Mon, Jan 11, 1999 at 14:42 +0100, Koenig, Thomas wrote:
ich brauche ein script, welches per ping, die Namensaufloesung und das Vorhandensein eines ftp servers checkt, wenn alles i.O. wird ein upload durgefuehrt, wenn nicht wird dieser Schritt ueber- sprungen.
ping -c 3 <server> && <upload> Damit wird, wenn Ping sich ohne Fehler beendet der Upload gestartet. Ciao, Stefan -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
participants (3)
-
axel@callisto.forbrf.lth.se
-
stefan.troeger@wirtschaft.tu-chemnitz.de
-
Thomas.Koenig-@dresdner-bank.com