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