#2203 the user's crontab gets erased when the Campcaster database is installed
This commit is contained in:
parent
7c5aef870b
commit
f183ef664d
campcaster/src/modules/storageServer/var
|
@ -71,10 +71,10 @@ class Crontab
|
|||
*/
|
||||
function readCrontab()
|
||||
{
|
||||
// Hmmm...this line looks like it erases the crontab file. -Paul
|
||||
@exec("echo | crontab -u {$this->user} -", $crons, $return);
|
||||
// return code is 0 or 1 if crontab was empty, elsewhere stop here
|
||||
$cmd = "crontab -u {$this->user} -l";
|
||||
@exec("crontab -u {$this->user} -l", $crons, $return);
|
||||
if ($return != 0) {
|
||||
if ($return > 1) {
|
||||
return PEAR::raiseError("*** Can't read crontab ***\n".
|
||||
" Set crontab manually!\n");
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ echo "done.\n";
|
|||
//------------------------------------------------------------------------
|
||||
require_once(dirname(__FILE__).'/../cron/Cron.php');
|
||||
|
||||
echo " * Adding cron job...";
|
||||
$cron = new Cron();
|
||||
$access = $cron->openCrontab('write');
|
||||
if ($access != 'write') {
|
||||
|
@ -94,6 +93,14 @@ if ($access != 'write') {
|
|||
$r = $cron->forceWriteable();
|
||||
} while ($r);
|
||||
}
|
||||
foreach ($cron->ct->getByType(CRON_CMD) as $line) {
|
||||
if (preg_match('/transportCron\.php/', $line['command'])) {
|
||||
$cron->closeCrontab();
|
||||
echo " * Storage cron job already exists.\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
echo " * Adding transport cron job...";
|
||||
$cron->ct->addCron('*/2', '*', '*', '*', '*', realpath("{$CC_CONFIG['cronDir']}/transportCron.php"));
|
||||
$cron->closeCrontab();
|
||||
echo "done.\n";
|
||||
|
|
Loading…
Reference in New Issue