Changeset 38 for trunk/www/task.php
- Timestamp:
- Jun 16, 2009, 5:26:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/task.php
r35 r38 25 25 $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,TimeCreate ASC'); 26 26 $this->Database->query('UPDATE Task SET State=2 WHERE State=1'); // Change not finished running tasks to finished 27 $this->Database->query('UPDATE Task SET TimeEnd=NOW() WHERE State=2'); // Set end time to finished tasks 27 28 while($Task = $DbResult->fetch_assoc()) 28 29 { … … 32 33 file_put_contents($this->TempScript, $Task['CommandList']); 33 34 chmod($this->TempScript, 0755); 34 //passthru($this->TempScript, $Output); 35 exec($this->TempScript, $Output); 36 $Output = implode("\n", $Output); 37 echo($Output); 35 exec($this->TempScript.' >'.$this->TempScript.'.log 2>'.$this->TempScript.'.err'); 36 $StdOut = file_get_contents($this->TempScript.'.log'); 37 unlink($this->TempScript.'.log'); 38 $StdErr = file_get_contents($this->TempScript.'.err'); 39 unlink($this->TempScript.'.err'); 38 40 echo("Hotovo\n"); 39 $this->Database->query('UPDATE Task SET TimeEnd=NOW(), State=2, Output="'.addslashes($Output).'" WHERE Id='.$Task['Id']);41 $this->Database->query('UPDATE `Task` SET `TimeEnd`=NOW(), `State`=2, `Output`="'.addslashes($StdOut).'", `Error`="'.addslashes($StdErr).'" WHERE `Id`='.$Task['Id']); 40 42 } 41 43 }
Note:
See TracChangeset
for help on using the changeset viewer.