Re: Affichage de différents messages sur la console

Pàgina inicial

Reply to this message
Autor: Stephane Driussi
Data:  
A: guilde
Assumpte: Re: Affichage de différents messages sur la console
j'ai un petit script qui tourne sous crontab vers une console texte:

cat /usr/local/bin/lightlog.sh
#!/bin/sh

clear
DATE=`date`
CPU=`sensors | awk '/CPU/{print $3}'`
MB=`sensors | awk '/SYS/{print $3}'`
HDD=`tail -1 /var/cache/via686/hdd_temp | awk '{print $2}'`
TRAFFIC=`tail -1 /var/cache/via686/traffic | awk '{print "Up",$2,"Ko/s
Down",$3,"Ko/s"}'`
echo "$DATE CPU:${CPU}°C Motherboard:${MB}°C Seagate:${HDD}°C
Traffic:$TRAFFIC"
echo " "
echo "******************** /var/adm/apache/pokie-access_log
************************"
echo " "
tail -12 /var/adm/apache/pokie-access_log | awk '{print
$1,$4,$6,$7,$8,$9,$10}'
echo " "
echo "*********************** /var/adm/plgrenouille.log
****************************"
echo " "
tail -12 /var/adm/plgrenouille.log
echo " "
echo "*************************** /var/adm/messages
********************************"
echo " "
grep from /var/adm/maillog | sed -e 's/, class.*//' | tail -20
# cut here %< ---------------------------------------------------

le resultat est le suivant:

lightlog.sh
Fri Feb 2 09:56:21 CET 2007 CPU:+36.5°C°C Motherboard:+34°C°C
Seagate:27°C Traffic:Up 2480 Ko/s Down 2698 Ko/s

******************** /var/adm/apache/pokie-access_log
************************

livebot-65-55-209-50.search.live.com [02/Feb/2007:09:19:58 "GET
/elec/LcdTerm/Lcd1.hex HTTP/1.0" 200 1956
livebot-65-55-209-50.search.live.com [02/Feb/2007:09:20:24 "GET
/elec.php?sub=alarme HTTP/1.0" 200 9033
livebot-65-55-209-50.search.live.com [02/Feb/2007:09:20:24 "GET
/elec.php?sub=chargeur HTTP/1.0" 200 20072
lj602321.inktomisearch.com [02/Feb/2007:09:20:28 "GET /robots.txt
HTTP/1.0" 200 24
lj611876.inktomisearch.com [02/Feb/2007:09:20:28 "GET /serveur.php
HTTP/1.0" 200 9620
livebot-65-55-209-50.search.live.com [02/Feb/2007:09:26:02 "GET
/elec/dtmf/simple.asm HTTP/1.0" 200 4635
livebot-65-55-209-50.search.live.com [02/Feb/2007:09:26:02 "GET
/elec/LcdTerm/afflcd.txt HTTP/1.0" 200 1307
livebot-65-55-209-50.search.live.com [02/Feb/2007:09:27:02 "GET
/elec/chargeur/chargeur.sch HTTP/1.0" 200 211703
livebot-65-55-235-142.search.live.com [02/Feb/2007:09:36:43 "GET
/robots.txt HTTP/1.0" 200 24
livebot-65-55-235-142.search.live.com [02/Feb/2007:09:36:44 "GET
/graph/temp.png HTTP/1.0" 200 8539
livebot-65-55-235-142.search.live.com [02/Feb/2007:09:43:20 "GET
/graph/dping.png HTTP/1.0" 200 5500
crawl-66-249-65-225.googlebot.com [02/Feb/2007:09:54:16 "GET
/photos.php?album=divgolf&page=1 HTTP/1.1" 200 9917

*********************** /var/adm/plgrenouille.log
****************************

Feb 2 08:47:54 UPLOAD bandwidth=93.92 ratioul=6 ratiodl=2 host=mir3.ovh.net
Feb 2 08:47:55 BREAKDOWN link=up
Feb 2 08:51:34 DOWNLOAD bandwidth=1219.46 ratiodl=4 ratioul=2
host=test-debit.free.fr
Feb 2 09:03:15 PING host=ul.grenouille.com sent=10 received=10
total_time=369.54
Feb 2 09:04:21 -- mark --
Feb 2 09:21:17 DOWNLOAD bandwidth=1325.38 ratiodl=4 ratioul=2
host=test-debit.free.fr
Feb 2 09:24:21 -- mark --
Feb 2 09:33:10 UPLOAD bandwidth=93.86 ratioul=6 ratiodl=2 host=mir3.ovh.net
Feb 2 09:33:26 PING host=ul.grenouille.com sent=10 received=10
total_time=370.66
Feb 2 09:44:21 -- mark --
Feb 2 09:48:01 BREAKDOWN link=up
Feb 2 09:51:29 DOWNLOAD bandwidth=1332.17 ratiodl=4 ratioul=2
host=test-debit.free.fr

*************************** /var/adm/messages
********************************

Feb 2 09:05:41 isere imapd[17347]: imap service init from 192.168.0.51
Feb 2 09:35:04 isere sm-mta[19240]: l128Z2n6019240:
from=<photos@???>, size=12787
Feb 2 09:35:06 isere spamd[586]: spamd: connection from localhost
[127.0.0.1] at port 55411
Feb 2 09:53:03 isere imapd[20368]: imap service init from 127.0.0.1
Feb 2 09:53:04 isere imapd[20370]: imap service init from 127.0.0.1


Le Jeu 1 février 2007 09:11, Frederic Ollivier a écrit :
> Salut,
>
> j'aimerais faire un truc purment esthétique mais partique,
> actuellement sur notre passerelle (redhat), j'ai l'affichage des logs
> de /var/log/messages
> (colorisé avec loco),
>
> j'aimerais voir aussi en alternance les logs de /var/log/httpd/access_log
>
> est ce qu'il serait possible de faire afficher succéssivement les 2 logs.
> en passant d'une console à l'autre par exemple tout les 5 secondes ?
>
> sinon y 'a til d'autres moyens "split" de la fenetre console en 2 ?
>
>
> d'avance merci
>
> --
> | Frederic Ollivier    Contrôleur Territorial
> |  Lycée Marie Curie - Région Rhône-Alpes -
> |    http://www.ac-grenoble.fr/webcurie
> |      User #282096 http://counter.li.org

>
> "Microsoft isn't evil, they just make really crappy operating
> systems." Linus Torvalds
>
>
>