Kaynağa Gözat

Version 1.0

master
Patrick Foubet 6 ay önce
ebeveyn
işleme
ff9bdaab73
2 değiştirilmiş dosya ile 36 ekleme ve 9 silme
  1. +15
    -9
      octave.c
  2. +21
    -0
      t1.sh

+ 15
- 9
octave.c Dosyayı Görüntüle

@@ -635,6 +635,7 @@ void pr_encours(void)
#define CHLOG "/var/log/user.log"
#define CHLOGREP "/var/log/user.log|grep "
#define CUT6 "|cut -d' ' -f6"
#define CUTM45 "|cut -d' ' -f1-3,6-"
#define CUT7S "|cut -d' ' -f7-"

#define FHISTO ".octave_history"
@@ -724,22 +725,27 @@ pid_t pid;
break;
case 'E' :
if (*(cmd+1) != '\0') printf("ignore %s\n",cmd+1);
sprintf(com,"grep '%s\\[%d\\]%s' %s",NPROG,pid,".*ERR: ",CHLOG);
sprintf(com,"grep '%s\\[%d\\]%s' %s%s",NPROG,pid,".*ERR: ",
CHLOG,CUTM45);
comsh(com);
break;
case 'L' :
if (*(cmd+1) != '\0') printf("ignore %s\n",cmd+1);
sprintf(com,"grep '%s\\[%d\\]' %s%s",NPROG,pid,
CHLOGREP,"-v 'Re[pq]. '");
sprintf(com,"grep '%s\\[%d\\]' %s%s%s",NPROG,pid,
CHLOGREP,"-v 'Re[pq]. '",CUTM45);
comsh(com);
break;
case 'T' :
if (*(cmd+1) != '\0')
sprintf(com,"grep '%s\\[%d\\].*%s' %s%s",NPROG,pid,cmd+1,
CHLOGREP," 'Re[pq]. '");
else
sprintf(com,"grep '%s\\[%d\\]' %s%s",NPROG,pid,
CHLOGREP," 'Re[pq]. '");
if (*(cmd+1) != '\0') { /* avec parametre */
if ((*(cmd+1) == '+') && (*(cmd+2) != '\0')) { /* script + param */
sprintf(com,"./t1.sh %d %s >.Trav%d",pid,cmd+2,pid);
comsh(com);
sprintf(com,"cat .Trav%d",pid);
} else sprintf(com,"grep '%s\\[%d\\].*%s' %s%s%s",NPROG,pid,cmd+1,
CHLOGREP," 'Re[pq]. '",CUTM45);
} else
sprintf(com,"grep '%s\\[%d\\]' %s%s%s",NPROG,pid,
CHLOGREP," 'Re[pq]. '",CUTM45);
comsh(com);
prInOut();
break;


+ 21
- 0
t1.sh Dosyayı Görüntüle

@@ -0,0 +1,21 @@
#! /bin/sh

explic ()
{
echo "Utilisation : $0 PID_OctavE mots_cles !" >&2
exit 1
}

[ $# != 2 ] && explic
liste=`grep 'OctavE\['$1'\].*'$2 /var/log/user.log|grep -v ' ERR: '|grep ': Re[pq]\. '|cut -d' ' -f7|sort|uniq`
p=""
for v in $liste
do
p=$p"|"$v
done
p2=`echo $p|sed 's/|//'`
# echo '('$p2')'
grep 'OctavE\['$1'\]' /var/log/user.log|egrep '('$p2')'|cut -d' ' -f1-3,6-




Yükleniyor…
İptal
Kaydet