🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #11756

Re: Un script sencillito...

#11756
From: Antonio Muñoz
Date: Sun, 14 Oct 2001 21:03
49 lines
2494 bytes
skalvin wrote:

> Hola,
> estoy intentando hacer un script para matar en un determinado momento el
> demonio esd 
> He pensado en  esto:
> 
> PID="`ps -A | grep esd | cut -c 0-5`"
> if  [ $PID!="" ]   ; then
>     # Matamos el proceso
>     kill -9 $PID
>     else echo ESD no esta up&running!
> fi
> 
> Bueno, el caso es que la condición del if  la cumple siempre. Como puedo
> hacerlo para que solo entre cuando la variable pid no contenga nada?
> De todas formas, fijo que hay alguna forma más optimizada de hacerlo....
> 
> gracias por la ayuda!
> 


Buenas!

Prueba a usar esto:

PID="`ps -A | grep esd | cut -c 0-5`"
if [ -z $PID ]; then
     echo ESD no esta up!
else
     # Matamos el proceso
     kill -9 $PID
fi

Saludos!

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Antonio Muñoz [tomby]         .--.
   agmunozNOSPAM@yahoo.com      |o_o |
   Linux User #226484           ||_/ |
   Rulando en Slackware 8.0    //   \ \
                              (|     | )
   "Be the source with you"  /'\_   _/`\
                             \___)=(___/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <3BC9FDBB.8020701@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!217-126-162-57.uc.nombres.ttd.ES!not-for-mail
References: <9qcmhb$muh0f$1@ID-83805.news.dfncis.de>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,2978759c87390d88
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-10-14 14:23:44 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!217-126-162-57.uc.nombres.ttd.ES!not-for-mail
From: Antonio Muñoz <agmunozNOSPAM@yahoo.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Un script sencillito...
Date: Sun, 14 Oct 2001 23:03:55 +0200
Organization: Tomby.Es
Lines: 50
Message-ID: <3BC9FDBB.8020701@yahoo.com>
References: <9qcmhb$muh0f$1@ID-83805.news.dfncis.de>
NNTP-Posting-Host: 217-126-162-57.uc.nombres.ttd.es (217.126.162.57)
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: fu-berlin.de 1003094622 24459225 217.126.162.57 (16 [104131])
X-Orig-X-Trace: alderaan.tomby.es 1003093489 18588 10.0.0.2 (14 Oct 2001 21:04:49 GMT)
X-Orig-X-Complains-To: news@news.tomby.es
X-Orig-NNTP-Posting-Date: Sun, 14 Oct 2001 21:04:49 +0000 (UTC)
X-Orig-Path: news.tomby.es!not-for-mail
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012
X-Accept-Language: es-es, en-us