Page 2 of 2 <12
Topic Options
#57873 - 2001-08-03 07:46 AM Re: automatic emails if ping fails
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
code:

$machine = "sh1262"
shell '%comspec% /c ping $machine -n 1 -w 20|find /c "'+'TTL=" 2>&1 >NUL'
? "existing machine returns: @error" ?
$machine = "sh01262"
shell '%comspec% /c ping $machine -n 1 -w 20|find /c "'+'TTL=" 2>&1 >NUL'
? "non existent machine returns: @error" ?
get $


existing machine gives you 0 and others 1

I don't think you should use batch file. why should you? do your code as:

code:

shell '%comspec% /c ping $machine -n 1 -w 200|find /c "'+'TTL=" 2>&1 >NUL'
if @error
shell 'mapisend -u test -p s -r pete.fry -s "ping'+' failed"'
endif


and you don't need to call any file.
this method is so much faster that I sincerely recommend it
_________________________
!

download KiXnet

Top
#57874 - 2001-08-04 07:58 PM Re: automatic emails if ping fails
Anonymous
Unregistered


why don't u use a program called SERVER ALIVE it emails u on the failin of a ping if you don't use it to ping more than 10 servers its free software!
Top
#57875 - 2001-08-05 02:14 AM Re: automatic emails if ping fails
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Peter,

Have a look at the following and this should help you along.

FTPCHECK.BAT - This to look to see when new DAT/SuperDAT files arrive a ftp.nai.com and now has the ability to get them.

ROUTERAVAIL.BAT - This is a script to check ROUTERS at specific intervals.
  • Written for Windows NT/2K
  • This is a cleaned up version of - http://itresources.brainbuzz.com/tutorials/tutorial.asp ?t=S1TU1239&tn=Router+check&pi=S4C16&pn=95%2F98%2FNT+Batch+Files
  • During the Business Day (7A-5P M-F), it checks the ROUTERS every three minutes
  • After hours (5P-7A M-F, and Weekends), it checks the ROUTERS every ten ninutes.
  • If a router is not found, it will try three additional times immediately to insure no false alarms.
  • If the SMTP Mail Server is not found, it uses RASDIAL to send a "911" Page.
  • It is also using SLEEP from the Resource Kit as well as POSTIE.
  • It logs when a router is down and when it returns as well as messaging appropriate parties.
  • ** NEW ** Cleaned up the Time of Day check.

GETKV5.ZIP

This file contains the following two useful utilities for DOS/9x/NT/W2K:

Getkeyd.exe is a real-mode MS-DOS version that should work with any version of DOS, Windows 9x, etc. Getkey.exe is a Win32 console-mode version for Windows 9x/NT/2000 (Intel only).

DOS and Windows 9x come with a choice command, and the Windows NT/2000 resource kit also comes with a version for Windows NT/2000. This is somewhat confusing since both file are named choice.exe. The choice utility is not as flexible as getkey. Also, getkey doesn't beep every time an invalid keystroke is pressed, which this author considers annoying.

Getvard.exe is a real-mode MS-DOS version that should work with any version of DOS, Windows 9x, etc. Getvar.exe is a Win32 console-mode version for Windows 9x/NT/2000 (Intel only).

Note that Windows 2000's version of CMD.EXE supports a variation of the SET command (SET /P) that allows interactive user input for a batch file. While this approach is "cleaner" than getvar's approach (no temporary files are used), it only works for CMD.EXE in Windows 2000 and later. Also, Windows 2000's SET /P command doesn't allow you to modify a pre-existing variable; it can only overwrite an existing variable or create a new one. Getvar does not have this limitation.

HTH,

- Kent

[ 05 August 2001: Message edited by: kdyer ]

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 611 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.05 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org