#!/etc/Tivoli/bin/perl
#####################################################################
# TITRE:	TivProc
#--------------------------------------------------------------------
# CREE LE:	06/04/1999			Par: V.BRION S.GISLAIN
#--------------------------------------------------------------------
# OBJET:	Verifie la presence du daemon oserv.
#			
#====================================================================
# Modifie le:	JJ/MM/AA		Par: 
#	Motif: motif ayant justifie la modification et points
#	modifies si besoin
#####################################################################
# REMARQUES: Les entetes des fonctions ont ete allegees pour plus
#            de lisibilite (fonction de petite taille et presque
#            identiques
#
#####################################################################
# CONVENTION DES CODES DE RETOUR (autre aue 0 (Ok) et 1 (erreur)
#
#====================================================================
# ACCES ET DROITS D'APPEL
#	Mode: 0777	Owner: 			Group:
#====================================================================
# PRE-REQUIS EN ENTREE
# Environnement materiel:
#	Machine: 			Constructeur: HP,SUN,IBM,SGI
# Environnement logiciel:
#	OS: hp-ux			Version: 9.05
#	    hp-ux				 10.20
#	    Solaris				 5.3
#	    Solaris				 5.5
#	    SunOs 				 4.1.3
#	    AIX					 3.x
#	    AIX					 4.2
#	    IRIX				 5.3
# Initialisation des variables globales (environnement, reseau...):
#	VARIABLE1	=	
#	VARIABLE2	=
#####################################################################
$NomTemplate = "";
				# Recuperation Nom de template
$NomTemplate = $ARGV[0] if(scalar( @ARGV ) > 0 );

exit 1 if ( $NomTemplate eq "" );

$Nombre = 0;
$DBDIR = $ENV{'DBDIR'};

if ( -f "$DBDIR/tme/log/LOCK" )
{
	@tableau = `ps -edf`;

	$Nombre = scalar( grep( /oserv/, @tableau ) );
}
else
{
	$Nombre = 1;
}

$Commande = "/logiciel/OpC/opcmon $NomTemplate=$Nombre";

#print "$Commande\n";

system( $Commande );

# eof
