summaryrefslogtreecommitdiffstats
path: root/client/shared/lib/httpd/LogCommand.sh
blob: 09656fc11cb5c788b2dc7a0979d0c73994a654a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
OGLOGCOMMAND=${OGLOGCOMMAND:-"/tmp/command.log"}
OGLOGCOMMANDTMP=$OGLOGCOMMAND.tmp
echo "Content-type: text/html"
echo ""
echo "<html><head>"
echo "<meta charset='utf-8'>"
echo "<meta http-equiv='Refresh' content='5,URL=./LogCommand.sh'> <link rel='stylesheet' type='text/css' href='oglive.css' />"
echo "<title>Bash as CGI</title></head><body>"

strings -e S $OGLOGCOMMAND > $OGLOGCOMMANDTMP

echo "<table>"

echo "<tr>"


echo "<TEXTAREA NAME='trackloghead' ROWS='13' COLS='175'>"
#echo "$(head -n 10 /tmp/command.log.tmp | uniq)"
# UHU - 2013/07/05 - Se incluye el simbolo % y la palabra sent para que se muestre la salida de rsync
egrep -v '^aclfilter|^deleting|^bytes|%|sent|^Elapsed:|^Total [Tt]ime:|^-|^\\|^\/' $OGLOGCOMMANDTMP | uniq | head -n 15 
echo "</TEXTAREA>"

echo "</tr>"


echo "<tr>"

echo "<TEXTAREA NAME='tracklogtail' ROWS='2' COLS='175'>"
#echo "$(tail -n 5 /tmp/command.log.tmp | uniq)"
# UHU - 2013/07/05 - Se incluye el simbolo % y la palabra sent para que se muestre la salida de rsync
egrep '^aclfilter|^deleting|^bytes|%|sent|^Elapsed:|^Total [Tt]ime:|^-|^\\|^\/' $OGLOGCOMMANDTMP | uniq | tail -n 2 
echo "</TEXTAREA>"


echo "</tr>"

echo "</table>"


echo "</body></html>"