'max' => 0,
),
- 'force' => array(
+ 'force' => array(
'desc' => 'Force redelivery, even if it has been sent before or not queued...',
'default' => 0,
'short' => 'f',
$this->send_to = $opts['send-to'];
}
+
+ $w = DB_DataObject::factory('core_notify_recur');
+ if (is_a($w, 'DB_DataObject')) {
+ $w->generateNotifications();
+ }
+
+
//DB_DataObject::debugLevel(1);
$w = DB_DataObject::factory($this->table);
die("DONE\n");
}
- function run($id, $email)
+ function run($id, $email, $cmdOpts="")
{
// phpinfo();exit;
$tn = tempnam(ini_get('session.save_path'),'stdout') . '.stdout';
$php = $_SERVER["_"];
$sn = $_SERVER["SCRIPT_NAME"];
- $cwd = $sn[0] == '/' ? dirname($sn) : dirname(realpath(getcwd() . $sn)); // same as run on.. (so script should end up being same relatively..)
+ $cwd = $sn[0] == '/' ? dirname($sn) : dirname(realpath(getcwd() . '/'. $sn)); // same as run on.. (so script should end up being same relatively..)
$app = $cwd . '/' . basename($_SERVER["SCRIPT_NAME"]) . ' ' . $this->target . '/'. $id;
if ($this->force) {
$app .= ' -f';
if (!empty($this->send_to)) {
$app .= ' --sent-to='.escapeshellarg($this->send_to);
}
- $cmd = $php . ' ' . $app; //. ' &';
+ $cmd = $php . ' ' . $app . ' ' . $cmdOpts; //. ' &';
$pipe = array();
//if (file_exists('/proc/'.$p['pid'])) {
$runtime = time() - $p['started'];
- echo "RUNTIME ({$p['pid']}): $runtime\n";
+ //echo "RUNTIME ({$p['pid']}): $runtime\n";
if ($runtime > $maxruntime) {
proc_terminate($p['proc'], 9);
- echo "TERMINATING: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']) . "\n";
//fclose($p['pipes'][1]);
fclose($p['pipes'][0]);
fclose($p['pipes'][2]);
-
+ echo "TERMINATING: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']) . "\n";
+ @unlink($p['out']);
continue;
}
$pool[] = $p;
continue;
}
-
- echo "CLOSING: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']) . "\n";
- //fclose($p['pipes'][1]);
fclose($p['pipes'][0]);
fclose($p['pipes'][2]);
+ //echo "CLOSING: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']) . "\n";
+ //fclose($p['pipes'][1]);
+
proc_close($p['proc']);
- clearstatcache();
- if (file_exists('/proc/'.$p['pid'])) {
- $pool[] = $p;
- continue;
- }
+ //clearstatcache();
+ //if (file_exists('/proc/'.$p['pid'])) {
+ // $pool[] = $p;
+ // continue;
+ //}
echo "ENDED: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']) . "\n";
-
+ @unlink($p['out']);
//unlink($p['out']);
}
echo "POOL SIZE: ". count($pool) ."\n";