Ping

  • #1
I

iea

Mitglied
Themenersteller
Dabei seit
12.01.2006
Beiträge
12
Reaktionspunkte
0
Hi,

ich brauche ein Batchfile die einen Befehl ausführt sobald ein Server wieder online ist.

also :

@ECHO OFF
PING \\server
IF NOT ERRORLEVEL 1 ECHO dER sERVER IS oNLINE
IF ERRORLEVEL 1 ECHO dER sERVER IS oFFLINE

Das Problem hier ist das die Abfrage aufhört wenn der Server nicht erreichbar ist.

THX

MfG

iea
 
  • #2
Versuchs mal mit ping -t
 
  • #3
Hallo iea,
läuft der Server nicht, wartet ping einen relativ langen Timeout ab, bis er sich zurück meldet. Probiers mal manuell in der Eingabeaufforderung. Ich denke, wenn Du lange genug wartest (ca. 1 bis 2 Minuten), wird das Skript auch weiterlaufen.
Viele Grüße - Ulrich
 
  • #4
ich wuerd es so probieren:

Code:
:1
@ECHO OFF
PING -n 2 192.168.0.2 > NULL
IF NOT ERRORLEVEL 1 ECHO der server ist online
IF ERRORLEVEL 1 ECHO der server ist offline
goto 1
 
  • #5
Hi danke für die Antworten hab es jetzt zum laufen bekommen


danke an alle

@ECHO OFF

ECHO ************************************************************************
ECHO * Checking if Printer LAN is still available *
ECHO ************************************************************************


PING 192.168.11.90
IF ERRORLEVEL 1 goto ende1
IF NOT ERRORLEVEL 1 goto dienst




:ende1
cls
ECHO ************************************************************************
ECHO * Adding the Printer NIC to the Local Machine *
ECHO ************************************************************************
netsh int ip add address Local Area Connection 192.168.11.90 255.255.255.0
goto start


:dienst
cls
ECHO ************************************************************************
ECHO * Checking if Spooler is still available *
ECHO ************************************************************************
sc \\192.168.11.101 start spooler
if errorlevel 1 goto error
if not errorlevel 1 goto all

:error
cls
ECHO ************************************************************************
ECHO * Closedown the Printer Server *
ECHO ************************************************************************
shutdown /s /m \\192.168.11.101
goto ping


:start
cls
ECHO ************************************************************************
ECHO * Waiting till System is online again *
ECHO ************************************************************************
PING 192.168.11.101
IF ERRORLEVEL 1 goto start
IF NOT ERRORLEVEL 1 goto ende

:ping
cls
ECHO ************************************************************************
ECHO * Waiting for System to come online *
ECHO ************************************************************************
PING 192.168.11.90
IF NOT ERRORLEVEL 1 goto ping
IF ERRORLEVEL 1 goto set


:ende
cls
ECHO ************************************************************************
ECHO *Please Press Enter ant than Disable and Enable the Remote Printer NIC *
ECHO ************************************************************************
pause
netsh int ip delete address Local Area Connection 192.168.11.90
goto all

:set
cls
ECHO ************************************************************************
ECHO * The Print IP will be added to the local System *
ECHO ************************************************************************
netsh int ip add address Local Area Connection 192.168.11.90 255.255.255.0

:all
cls
ECHO ************************************************************************
ECHO * All changes have been done *
ECHO ************************************************************************
pause
 
Thema:

Ping

ANGEBOTE & SPONSOREN

Statistik des Forums

Themen
113.840
Beiträge
707.963
Mitglieder
51.494
Neuestes Mitglied
Flensburg45
Oben