Thread View: es.comp.os.linux.programacion
1 messages
1 total messages
Started by slinux
Fri, 14 Oct 2005 17:03
Re: bash: comprobar estado de server
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads