In this example, we report the existence of a core file in the root directory, also remove it in order to reclaim vital disk space.
The RootCoreFileExist script might send an alert message like the following:
-------------------------------------------------------------------------------
PIKT ALERT
Mon Oct 20 11:44:18 2003
nantes
URGENT:
RootCoreFileExist
Report and remove /core files
/core: ELF 32-bit MSB core file SPARC Version 1, from 'syslogd'
-rw------- 1 root other 1078508 Oct 7 03:10 /core
moved /core file to /tmp, after the move:
/dev/dsk/c0t0d0s0 1984230 1426880 497824 75% /
-------------------------------------------------------------------------------
RootCoreFileExist makes reference to =mvrootcore(), defined as a macro (because we might want to use this code sequence in other scripts) in macros.cfg as:
mvrootcore(D)
if -e "/core"
output mail $command("=file /core 2>/dev/null")
output mail $command("=ll /core")
=execwait "=mv /core (D)"
output mail "moved /core file to (D), after the move:"
output mail $command("=dfl / | =behead(1)")
endif
The script follows.
///////////////////////////////////////////////////////////////////////////////
//
// files_system_alarms.cfg
//
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
RootCoreFileExist
init
status active
level urgent
task "Report and remove /core files"
begin
=mvrootcore(/tmp)
///////////////////////////////////////////////////////////////////////////////
[other alarms omitted...]
///////////////////////////////////////////////////////////////////////////////
This is just one program example. You could add rules, or write new scripts, for example to: report the existence of core files elsewhere (other than in the root directory), archive core files for later inspection, etc.
[For more examples, see Samples.]
Home |
FAQ |
News |
Intro |
Samples |
Tutorial |
Reference |
Software |
Authors |
Licensing |
SiteSearch
Links |
SiteIndex |
Pikt-Users |
Pikt-Workers |
Contribute |
ContactUs |
Top of Page
Page best viewed at 1024x768.
Page last updated 2005-06-22.
This site is
PIKT®
powered.
PIKT® is a registered trademark of the University of Chicago.
Copyright © 1998-2005 Robert Osterlund. All rights reserved.
|