Bonjour,

J'ai fais un script pour arreter puis redémarrer un demon après la vérification du PID . Apparemment il fonctionnait très bien hier et sans aucune modification de ma part il ne fonctionne plus ce matin .

Mon problème vient dans la partie de la vérification du PID. En effet celui est déja arrèté et mon script me trouve toujours un PID. Extrait du script :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use warnings;
use strict;
my $daemon="dori";
my $ED="Doce";
my $lmpid1=`ps -ef | grep $daemon | egrep -v grep | awk '{print \$3}'`;
my $lmpid2=`ps -ef | grep $daemon | egrep -v grep | awk '{print \$4}'`;
if ($lmpid1) {
        die "[Error] $ED license server doesn't want to stop.\n $daemon is running with PID : $lmpid1 \n or lmgrd is still running with PID : $lmpid2 \n" ;
}
Il me retourne ceci :
[Error] Doce license server doesn't want to stop.
dori is running with PID : 17667

or lmgrd is still running with PID : 0

Cela est bizarre parce que quand je vérifie le PID 17667 voici ce que j'ai :
~]# ps -aef | grep 17667
root 17667 17666 0 11:17 pts/5 00:00:00 -bash
root 18215 17667 0 11:40 pts/5 00:00:00 ps -aef
root 18216 17667 0 11:40 pts/5 00:00:00 grep 17667

Comme pourrais je avoir le bon PID pour que la vérification fonctionne à tous les coups ?

Merci de votre aide....