source: trunk/cronic.txt @ 37

Last change on this file since 37 was 37, checked in by gegorbet, 5 years ago

gridctl mods for mysqli and aucsolutions, plus new text for crontabs and cronic

  • Property svn:keywords set to LastChangedDate Author
File size: 880 bytes
Line 
1/bin/cronic
2#!/bin/bash
3
4# Cronic v2 - cron job report wrapper
5# Copyright 2007 Chuck Houpt. No rights reserved, whatsoever.
6# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/
7
8set -eu
9
10OUT=/tmp/cronic.out.$$
11ERR=/tmp/cronic.err.$$
12TRACE=/tmp/cronic.trace.$$
13
14set +e
15"$@" >$OUT 2>$TRACE
16RESULT=$?
17set -e
18
19PATTERN="^${PS4:0:1}\\+${PS4:1}"
20if grep -aq "$PATTERN" $TRACE
21then
22    ! grep -av "$PATTERN" $TRACE > $ERR
23else
24    ERR=$TRACE
25fi
26
27if [ $RESULT -ne 0 -o -s "$ERR" ]
28    then
29    echo "Cronic detected failure or error output for the command:"
30    echo "$@"
31    echo
32    echo "RESULT CODE: $RESULT"
33    echo
34    echo "ERROR OUTPUT:"
35    cat "$ERR"
36    echo
37    echo "STANDARD OUTPUT:"
38    cat "$OUT"
39    if [ $TRACE != $ERR ]
40    then
41        echo
42        echo "TRACE-ERROR OUTPUT:"
43        cat "$TRACE"
44    fi
45fi
46
47rm -f "$OUT"
48rm -f "$ERR"
49rm -f "$TRACE"
Note: See TracBrowser for help on using the repository browser.