summaryrefslogtreecommitdiffstats
path: root/adei/scripts/log.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
commit79c76eaef5039276bb3a8725ac8c9f05f89ef0de (patch)
tree1bde68d36ce44d75fafc6dfb41f5f6d2b555815f /adei/scripts/log.sh
parentbc1b77dc912adfd040d432972e2d3256c9ea2065 (diff)
downloadadei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.gz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.bz2
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.xz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.zip
Optimize Dockerfile
Diffstat (limited to 'adei/scripts/log.sh')
-rwxr-xr-xadei/scripts/log.sh54
1 files changed, 0 insertions, 54 deletions
diff --git a/adei/scripts/log.sh b/adei/scripts/log.sh
deleted file mode 100755
index 4237682..0000000
--- a/adei/scripts/log.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /bin/bash
-
-max_age=10
-max_mails=10
-log_lines=50
-
-cur=`date +%s`
-since=$(($cur - $max_age * 60))
-
-echo "Apache error log"
-echo "================"
-tail -n $log_lines /var/log/apache2/error_log | perl -MDateTime::Format::Strptime -F';' -ane '
- my $parser = DateTime::Format::Strptime->new(
- pattern => "%a %b %d %H:%M:%S.%N %Y"
- );
- my $formater = DateTime::Format::Strptime->new(
- pattern => "%s"
- );
- if (/^\[([^]]+)\]/) {
- $last = $formater->format_datetime($parser->parse_datetime($1));
- } elsif ($last !~ /\d+/) {
- $last = 0;
- }
- print "$last $_\n";
-' | awk "{ if (\$1 > $since) print \$0 }" | cut -d ' ' -f 2-
-echo
-echo
-
-
-mails=`mailutil check | cut -d ' ' -f 6`
-if [ "$mails" == "in" ]; then
- mails=`mailutil check | cut -d ' ' -f 4`
-fi
-
-if [ $mails -gt 0 ]; then
- [ $mails -gt $max_mails ] && mails=$max_mails
-
- cur=`date -u +%s`
- for id in `seq $mails -1 1`; do
- mail=$(($mails - $id + 1))
-
- lastmail=`echo "type $mail" | mailx -R "" -N`
- dt=`echo "$lastmail" | grep "From" | head -n 1 | cut -d ' ' -f 3-`
- last=`date -u --date "$dt" +%s`
- since=$((($cur - $last) / 60))
- if [ $since -le $max_age ]; then
- echo "Cron reports on$dt"
- echo "========================================"
- echo "$lastmail" | sed -e '1,/^$/d' | head -n 10
- echo
- echo
- fi
- done
-fi