Changeset 6 for trunk/www/process_tasks.php
- Timestamp:
- Jun 10, 2009, 4:57:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/process_tasks.php
r5 r6 5 5 chdir('..'); 6 6 7 $Script = '/tmp/wowhosting_script.sh'; 7 8 $DbResult = $Database->query('SELECT * FROM Task WHERE Executed = 0 ORDER BY Time ASC'); 8 9 while($Task = $DbResult->fetch_assoc()) 9 10 { 10 11 echo('Provádím '.$Task['Title']."...\n"); 11 foreach(explode("\n", $Task['CommandList']) as $Command)12 {13 $Output = array();14 echo($Command."\n");15 exec($Command, $Output);16 echo(implode("\n", $Output));17 }18 $Database->query('UPDATE Task SET Executed=1 WHERE Id='.$Task['Id']);12 $Task['CommandList'] = "#!/bin/sh\n".$Task['CommandList']; 13 file_put_contents($Script, $Task['CommandList']); 14 chmod($Script, 0755); 15 passthru($Script, $Output); 16 //exec($Script, $Output); 17 $Output = ''; //implode("\n", $Output); 18 //echo($Output); 19 $Database->query('UPDATE Task SET Executed=1, Output="'.addslashes($Output).'" WHERE Id='.$Task['Id']); 19 20 } 20 21
Note:
See TracChangeset
for help on using the changeset viewer.