clfs-1.2
clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since 873009c was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago |
r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure
|
-
Property mode
set to
100755
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Log and Error handling funcrions
|
---|
4 | # -----------------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | #---------------------------------------
|
---|
12 | # Standard log initialization functions
|
---|
13 | #---------------------------------------
|
---|
14 |
|
---|
15 | BRKLN='================================================================================' # Break line
|
---|
16 | export BRKLN
|
---|
17 |
|
---|
18 |
|
---|
19 | max_log_init() { # $1=pkg $2=vers or text $3=dynam|stat|init|some text
|
---|
20 | # $4=<log-directory> $5=<log-filename>
|
---|
21 |
|
---|
22 | LOGFNAME="${5}-${DATE}"
|
---|
23 | min_log_init ${4} ||
|
---|
24 | return 1 # Control in mainline. Chg to exit for bail out!
|
---|
25 |
|
---|
26 | echo "### ${1} ${2} - ${3} - ${TS} ###"
|
---|
27 |
|
---|
28 | }
|
---|
29 |
|
---|
30 | min_log_init() { # $1=<log-directory>
|
---|
31 | # If log start fails, error out w/message and return code
|
---|
32 | TS=$(date) # Save a call
|
---|
33 | LOGFILE="${1}/${LOGFNAME}"
|
---|
34 | echo -e "${SELF} - ${LOGFNAME} - ${TS}\n${BRKLN}" > ${LOGFILE} ||
|
---|
35 | {
|
---|
36 | echo "min_log_init: writing ${LOGFILE} fail. Space/permissions?" \
|
---|
37 | &>/dev/tty
|
---|
38 | return 2 # Control in mainline. Chg to exit for bail out!
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | #---------------------------------------
|
---|
44 | # Standard error handling functions
|
---|
45 | #---------------------------------------
|
---|
46 | errmsg() {
|
---|
47 | # Simply prints an error message, indicating which
|
---|
48 | # logfile to look at.
|
---|
49 | echo "XXXXXX NOT OK - CHECK LOG ${LOGFILE} XXXXXX"
|
---|
50 | }
|
---|
51 |
|
---|
52 | barf() {
|
---|
53 | # prints error message and exits
|
---|
54 | errmsg
|
---|
55 | exit 1
|
---|
56 | }
|
---|
57 |
|
---|
58 | # Export functions
|
---|
59 | export -f max_log_init
|
---|
60 | export -f min_log_init
|
---|
61 | export -f errmsg
|
---|
62 | export -f barf
|
---|
63 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.