README

fnds

xle

fnds
1/19/11

$Id: README,v 1.3 2011/09/23 16:10:56 fnds Exp $

Intro

xle runs a shell script, checks for errors and sends email to the sysadmin.

Designed to run from crontab, it runs silently and sends all output to $MAINDIR/logs/xle.log

Initially written and tested on Red Hat 4. Solaris 9 support was added later.

Defaults can be changed on $MAINDIR/xle.conf

For usage details, type $MAINDIR/xle

$ cd /home/oracle/xle
$ ./xle

USAGE: xle [ options ] script arg1 ... argn

Options:
    -e a    (a)lways sends email (DEFAULT)
    -e n    (n)ever sends email
    -e e    sends email only when there was an (e)rror
    -e s    sends email only when it finishes (s)ucessfully

    -a <alias>      script alias to be used when script name is not descriptive
    -c <cfg file>   use designated configuration file (full path required)
    -s <script>     execute <script> file at ./scripts
    -l              include log file contents in the report sent by email
    -t <email>      mail to address

    -?              displays help message

$Id: README,v 1.3 2011/09/23 16:10:56 fnds Exp $

Config file

Edit the config file to change the sysadmin e-mail, directories, etc

Log files

The main log file xle.log is kept at $MAINDIR/logs. It keeps a record of
every script executed by xle.

Every run of each script generates one log file with the script output.

The log files are also kept at $MAINDIR/logs and are named with the script name and a timestamp:

    Example:

    copy2dr.20090510213011.log

    Log file for the copy2dr script that ran on May 10 2009 at 9:30:11 PM.

In addition to log files, a mail file is generated that contains a copy of the
report sent by email to the sysadmin:

    Example:

    copy2dr.20090510213011.rep

    Same name convention as the example above but ending with .rep

crontab examples

$MAINDIR is the directory where xle is installed. We use /usr/local/xle

The examples were tested on Red Hat.

  • Execute the shell script copy2dr and send email to the sysadmin with results.

    PATH=/usr/local/bin:/bin:/usr/bin:/home/oracle/xle
    30 21 * * * xle /home/oracle/scripts/backups/copy2dr DB1
    
  • Execute the script $MAINDIR/scripts/analyze_schema and send email to the sysadmin.
    The "-s" option tells it to look for the script at $MAINDIR/scripts.

    PATH=/usr/local/bin:/bin:/usr/bin:/home/oracle/xle
    30 19 * * * xle -s analyze_schema
    
  • Execute the shell script copy2dr and send email to the sysadmin only if there are errors, "-e e" option.

    PATH=/usr/local/bin:/bin:/usr/bin:/home/oracle/xle
    30 21 * * * xle -e e /home/oracle/scripts/backups/copy2dr DB1
    
  • Execute the shell script copy2dr but never send email, "-e n" option.
    Log files are still kept at $MAINDIR/logs

    PATH=/usr/local/bin:/bin:/usr/bin:/home/oracle/xle
    30 21 * * * xle -e e /home/oracle/scripts/backups/copy2dr DB1
    
  • Execute the script 'dbrun' but use the alias 'analyze' to identify it, "-a analyze" option

    45 18 * * * xle -a analyze /home/oracle/bin/dbrun -b /home/oracle/scripts/analyze_appschema DB1 DB2
    

End


Related

Home: Home

MongoDB Logo MongoDB