Root Core File

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.

RootCoreFileExist

        init
                status =piktstatus
                level =piktlevel
                task "Report and remove /core files"

        begin
                =mvrootcore(/tmp)

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
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
clear tmp
directories
Pikt script