Article View: es.comp.os.linux.programacion
Article #1520Re: bash: comprobar estado de server
From: slinux
Date: Fri, 14 Oct 2005 17:03
Date: Fri, 14 Oct 2005 17:03
36 lines
1970 bytes
1970 bytes
siguiendo con la shell...como puedo lanzar procesos en segundo plano ('&') y utilizar varios comandos en una l�nea (';')
#include <stdio.h
#include <stdlib.h
#include <string.h
#include <sys/types.h
#include <unistd.h
#include <sys/wait.h
int main()
{
char linea[34421];
while (fgets(linea�34421�stdin)) {
pid_t pid;
if (pid=fork()) { if (pid0) wait(0); }
else {
char *palabras[17210]�*s=linea; int i=0;
while (palabras[i++]=strtok(s� � \t\n")) { s=0; }
execvp(palabras[0]� palabras); exit(1);
}
}
return 0;
}
gracias
--
slinux
------------------------------------------------------------------------
Ver este tema: http://www.softwaremix.net/viewtopic-436628.html
Enviado desde http://www.softwaremix.net
Technical Details
Message-ID:
<slinux.1wwrex@no-mx.softwaremix.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f86c8,2a1c373ad66a1455,start X-Google-Attributes: gidf86c8,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 14 Oct 2005 15:03:50 -0500 From: slinux <slinux.1wwrex@no-mx.softwaremix.net> Newsgroups: es.comp.os.linux.programacion Subject: Re: bash: comprobar estado de server Date: Fri, 14 Oct 2005 19:03:45 +0200 Message-ID: <slinux.1wwrex@no-mx.softwaremix.net> Organization: Softwaremix.net User-Agent: Punbb USENET gateway X-Newsreader: Punbb USENET gateway X-Originating-IP: 80.224.176.74<dh9ker$nu$1@news-16.escomposlinux.org> Lines: 2 NNTP-Posting-Host: 70.85.210.130 X-Trace: sv3-XOuejD7zyTo/J8UVi3hlPzXLFZCpXHuo+RqgARN75mJ/qmxM+Emr4KDsH8UJuoS1PEHkVCNaJv78HNi!MOBt2L8m+8H03V5Ifl4mnHGwleq48RTAbWF/R/sUufuq88XZ79xmXEFKktXQDcvaFxfcqw== X-Complaints-To: abuse@ya.com X-DMCA-Complaints-To: abuse@ya.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32