Skip to content

Commit 79bc50c

Browse files
committed
Fixed bug #265 cronjob creates emails on some systems.
1 parent faf3f50 commit 79bc50c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

install/lib/installer_base.lib.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,14 @@ public function install_crontab()
895895
exec('crontab -u root -l > crontab.txt');
896896
$existing_root_cron_jobs = file('crontab.txt');
897897

898+
// remove existing ispconfig cronjobs, in case the syntax has changed
899+
foreach($existing_root_cron_jobs as $key => $val) {
900+
if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
901+
}
902+
898903
$root_cron_jobs = array(
899-
'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
900-
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
904+
'* * * * * /usr/local/ispconfig/server/server.sh > /dev/null',
905+
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null'
901906
);
902907
foreach($root_cron_jobs as $cron_job) {
903908
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
@@ -913,7 +918,13 @@ public function install_crontab()
913918
exec('crontab -u getmail -l > crontab.txt');
914919
$existing_cron_jobs = file('crontab.txt');
915920

916-
$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf &> /dev/null');
921+
$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null');
922+
923+
// remove existing ispconfig cronjobs, in case the syntax has changed
924+
foreach($cron_jobs as $key => $val) {
925+
if(stristr($val,$cf['program'])) unset($cron_jobs[$key]);
926+
}
927+
917928
foreach($cron_jobs as $cron_job) {
918929
if(!in_array($cron_job."\n", $existing_cron_jobs)) {
919930
$existing_cron_jobs[] = $cron_job."\n";

0 commit comments

Comments
 (0)