In PowerShell, it's pretty easy to get back the last line of a file and compare
it to a search string. I think you could wrap the following in a batch file
that calls PowerShell - assuming you have or can have PowerShell installed on
your ServersAlive box.
$file = $args[0]
$pattern = $args[1]
if ((Get-Content $file | Select-Object -Last 1) -match $pattern) {
exit 1
}
The script as is would take 2 arguments: 1.) the file you want to query and 2.)
the string to look for. I don't have a quick/easy means of testing this on an
SA installation but it seems as though that would work as an external check - 1
for failure and 0 for success.
--
Thanks,
Marcus L. Farmer
Bounce10
Director of Systems & Networking · 865-540-4242 x103·
865-755-0652 (cell) · [email protected]
(mailto:[email protected])
Advancing eCommerce · Building eBusiness· Creating eCustomers
a KBX Group, Inc. company
From: Servers Alive Discussion List [mailto:[email protected]] On Behalf Of
Jason Passow
Sent: Monday, July 20, 2009 3:06 PM
To: Servers Alive Discussion List
Subject: [SA-list] File Last Line check
I have a mail server that writes entries to the end of a file. I need to
monitor the last record in that file and if it contains a matching string send
alert with that string. Is there a check written for this or how much would
it cost me to have someone write a com check for this?
Jason Passow
Mississippi Welders Supply
http://www.mwsco.com
[email protected]
ph: (507) 494-5178
fax: (507) 454-8104
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.