- Timestamp:
- Sep 17, 2010, 12:51:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi/mindi
r2681 r2685 109 109 fi 110 110 111 # Last function called before exiting 112 # Parameter is exit code value 113 # Should be declared here as used immediately below potentialy 114 MindiExit() { 115 echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE 116 echo "End date : `date`" >> $LOGFILE 117 if [ _"$MONDO_SHARE" != _"" ] ; then 118 echo "------------- mindi logfile included -------------------------" >> /var/log/mondoarchive.log 119 cat $LOGFILE >> /var/log/mondoarchive.log 120 echo "--------------------------------------------------------------">> /var/log/mondoarchive.log 121 fi 122 123 cd / 124 sync& 125 126 # Clean temporary files only when standalone mindi 127 if [ _"$MINDI_TMP" != _"$MONDO_TMP" ]; then 128 rm -Rf $MINDI_TMP 129 fi 130 exit $1 131 } 132 133 LogIt() { 134 if [ -e /dev/stderr ] ; then 135 echo -e "$1" >> /dev/stderr 136 elif [ -e /usr/bin/logger ] ; then 137 /usr/bin/logger -s $1 138 fi 139 echo -e "$1" >> $LOGFILE 140 if [ _"$2" != _"" ]; then 141 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE 142 fi 143 rm -f "$2" 144 } 145 146 147 Die() { 148 local i 149 if [ "$1" = "" ] ; then 150 LogIt "FATAL ERROR" 151 else 152 LogIt "FATAL ERROR. $1" 153 fi 154 if [ _"$2" != _"" ]; then 155 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE 156 fi 157 rm -f "$2" 158 159 LogIt "Please e-mail a copy of $LOGFILE to the mailing list." 160 LogIt "See http://www.mondorescue.org for more information." 161 LogIt "WE CANNOT HELP unless you enclose that file.\n" 162 MindiExit -1 163 } 164 111 165 # Now we can create what we need 112 166 MINDI_TMP=`mktemp -d $TMPDIR/mindi.XXXXXXXXXX` … … 237 291 done 238 292 echo $r 239 }240 241 242 # Last function called before exiting243 # Parameter is exit code value244 MindiExit() {245 echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE246 echo "End date : `date`" >> $LOGFILE247 if [ _"$MONDO_SHARE" != _"" ] ; then248 echo "------------- mindi logfile included -------------------------" >> /var/log/mondoarchive.log249 cat $LOGFILE >> /var/log/mondoarchive.log250 echo "--------------------------------------------------------------">> /var/log/mondoarchive.log251 fi252 253 cd /254 sync&255 256 # Clean temporary files only when standalone mindi257 if [ _"$MINDI_TMP" != _"$MONDO_TMP" ]; then258 rm -Rf $MINDI_TMP259 fi260 exit $1261 }262 263 Die() {264 local i265 if [ "$1" = "" ] ; then266 LogIt "FATAL ERROR"267 else268 LogIt "FATAL ERROR. $1"269 fi270 if [ _"$2" != _"" ]; then271 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE272 fi273 rm -f "$2"274 275 LogIt "Please e-mail a copy of $LOGFILE to the mailing list."276 LogIt "See http://www.mondorescue.org for more information."277 LogIt "WE CANNOT HELP unless you enclose that file.\n"278 MindiExit -1279 293 } 280 294 … … 906 920 echo "$output" 907 921 return 0 908 }909 910 911 LogIt() {912 if [ -e /dev/stderr ] ; then913 echo -e "$1" >> /dev/stderr914 elif [ -e /usr/bin/logger ] ; then915 /usr/bin/logger -s $1916 fi917 echo -e "$1" >> $LOGFILE918 if [ _"$2" != _"" ]; then919 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE920 fi921 rm -f "$2"922 922 } 923 923
Note:
See TracChangeset
for help on using the changeset viewer.