Mit popen Ausgabe des at-Kommandos lesen



  • Hi,

    ich versuche aus C unter Linux einen At-Job anzulegen und die Ausgabe zu lesen. Leider kommt in meiner Pipe nichts an:

    FILE *pipe;
    	int LENGTH = 200;
    	char buffer[LENGTH];
    	int line = 0;
    
    	pipe = popen ("echo \"~/src/task.pl\" | at now +1min ", "r"); 
    
    	while (fgets(buffer, LENGTH, pipe))
    	{
    		printf(">> %i %s",line++, buffer);
    	}
    
    	if (pclose (pipe) != 0)
        {
    	    printf ("Could not run at command\n");
    	    return;
        }
    

    Hat jemand eine Idee?

    Viele Grüße,
    foobar



  • Hallo,

    besser spaet wie nie...

    der "at" Befehl schreibt seine Rueckmeldung nach stderr.

    Versuch mal

    pipe = popen ("echo \"~/src/task.pl\" | at now +1min 2>&1", "r")
    

    Viele Gruesse
    hago


Anmelden zum Antworten