From ad90a3fa3e169b054c52c5496828f9848a1dd7d5 Mon Sep 17 00:00:00 2001 From: Marius Cramer Date: Thu, 14 Aug 2014 08:58:03 +0200 Subject: [PATCH] - Fixed: FS#3588 - root crontab error (confirmed by me at some last versions 3.1 dev from svn) - removed cuplicate code from os-specific installer files --- install/dist/lib/fedora.lib.php | 86 ------------------------------ install/dist/lib/opensuse.lib.php | 85 ----------------------------- install/lib/installer_base.lib.php | 4 +- 3 files changed, 2 insertions(+), 173 deletions(-) diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index 7cd3e8b2d..a6250bbb4 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -1233,92 +1233,6 @@ class installer_dist extends installer_base { if(!is_link('/usr/local/bin/ispconfig_patch')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_patch /usr/local/bin/ispconfig_patch'); } - - public function configure_dbserver() - { - global $conf; - - //* If this server shall act as database server for client DB's, we configure this here - $install_dir = $conf['ispconfig_install_dir']; - - // Create a file with the database login details which - // are used to create the client databases. - - if(!is_dir("$install_dir/server/lib")) { - $command = "mkdir $install_dir/server/lib"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master"); - $content = str_replace('{hostname}', $conf['mysql']['host'], $content); - $content = str_replace('{username}', $conf['mysql']['admin_user'], $content); - $content = str_replace('{password}', $conf['mysql']['admin_password'], $content); - wf("$install_dir/server/lib/mysql_clientdb.conf", $content); - exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf"); - exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf"); - - } - - public function install_crontab() - { - global $conf; - - //* Root Crontab - exec('crontab -u root -l > crontab.txt'); - $existing_root_cron_jobs = file('crontab.txt'); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_root_cron_jobs as $key => $val) { - if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]); - } - - $root_cron_jobs = array( - '* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null', - '30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null' - ); - - if ($conf['nginx']['installed'] == true) { - $root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null"; - } - - foreach($root_cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { - $existing_root_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_root_cron_jobs); - exec('crontab -u root crontab.txt &> /dev/null'); - unlink('crontab.txt'); - - //* Getmail crontab - if(is_user('getmail')) { - $cf = $conf['getmail']; - exec('crontab -u getmail -l > crontab.txt'); - $existing_cron_jobs = file('crontab.txt'); - - $cron_jobs = array( - '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null' - ); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_cron_jobs as $key => $val) { - if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]); - } - - foreach($cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_cron_jobs)) { - $existing_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_cron_jobs); - exec('crontab -u getmail crontab.txt &> /dev/null'); - unlink('crontab.txt'); - } - - exec('touch /var/log/ispconfig/cron.log'); - exec('chmod 660 /var/log/ispconfig/cron.log'); - } - } ?> diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php index 12c07b1f8..1144776aa 100644 --- a/install/dist/lib/opensuse.lib.php +++ b/install/dist/lib/opensuse.lib.php @@ -1305,91 +1305,6 @@ class installer_dist extends installer_base { } - public function configure_dbserver() - { - global $conf; - - //* If this server shall act as database server for client DB's, we configure this here - $install_dir = $conf['ispconfig_install_dir']; - - // Create a file with the database login details which - // are used to create the client databases. - - if(!is_dir("$install_dir/server/lib")) { - $command = "mkdir $install_dir/server/lib"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master"); - $content = str_replace('{hostname}', $conf['mysql']['host'], $content); - $content = str_replace('{username}', $conf['mysql']['admin_user'], $content); - $content = str_replace('{password}', $conf['mysql']['admin_password'], $content); - wf("$install_dir/server/lib/mysql_clientdb.conf", $content); - exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf"); - exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf"); - - } - - public function install_crontab() - { - global $conf; - - //* Root Crontab - exec('crontab -u root -l > crontab.txt'); - $existing_root_cron_jobs = file('crontab.txt'); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_root_cron_jobs as $key => $val) { - if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]); - } - - $root_cron_jobs = array( - '* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null', - '30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null' - ); - - if ($conf['nginx']['installed'] == true) { - $root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null"; - } - - foreach($root_cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { - $existing_root_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_root_cron_jobs); - exec('crontab -u root crontab.txt &> /dev/null'); - unlink('crontab.txt'); - - //* Getmail crontab - if(is_user('getmail')) { - $cf = $conf['getmail']; - exec('crontab -u getmail -l > crontab.txt'); - $existing_cron_jobs = file('crontab.txt'); - - $cron_jobs = array( - '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null' - ); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_cron_jobs as $key => $val) { - if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]); - } - - foreach($cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_cron_jobs)) { - $existing_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_cron_jobs); - exec('crontab -u getmail crontab.txt &> /dev/null'); - unlink('crontab.txt'); - } - - exec('touch /var/log/ispconfig/cron.log'); - exec('chmod 660 /var/log/ispconfig/cron.log'); - } - } ?> diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index c1d9c4870..b78f8f4db 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2196,8 +2196,8 @@ class installer_base { } $root_cron_jobs = array( - "* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done", - "* * * * * ".$install_dir."/server/cron.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done" + "* * * * * ".$install_dir."/server/server.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done", + "* * * * * ".$install_dir."/server/cron.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done" ); if ($conf['nginx']['installed'] == true) { -- GitLab