Ver Mensaje Individual
  #6 (permalink)  
Antiguo 16/08/2011, 02:20
mariano_donati
 
Fecha de Ingreso: marzo-2005
Mensajes: 1.418
Antigüedad: 19 años, 1 mes
Puntos: 9
Respuesta: Cómo detener un script ejecutándose en background

Por si alguien está interesado, aquí va como lo solucioné:

1. En el demonio al inicio creo el archivo
Código PHP:
Ver original
  1. $flagFile = fopen("running.txt", "a");
  2. fclose($flagFile);

2. En cada iteración verifico que el archivo exista
Código PHP:
Ver original
  1. while(file_exists("running.txt")
  2. {
  3.      //Implementación del demonio
  4. }

3. En el archivo stop_daemon.php
Código PHP:
Ver original
  1. unlink("running.txt");

stop_daemon.php y daemon.php deben estar en el mismo directorio.
Espero que alguien le sirva.
Gracias por su ayuda.
__________________
Add, never Remove