Skip to content

Commit ad90a3f

Browse files
author
Marius Cramer
committed
- 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
1 parent 7042add commit ad90a3f

File tree

3 files changed

+2
-173
lines changed

3 files changed

+2
-173
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,92 +1233,6 @@ public function install_ispconfig()
12331233
if(!is_link('/usr/local/bin/ispconfig_patch')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_patch /usr/local/bin/ispconfig_patch');
12341234

12351235
}
1236-
1237-
public function configure_dbserver()
1238-
{
1239-
global $conf;
1240-
1241-
//* If this server shall act as database server for client DB's, we configure this here
1242-
$install_dir = $conf['ispconfig_install_dir'];
1243-
1244-
// Create a file with the database login details which
1245-
// are used to create the client databases.
1246-
1247-
if(!is_dir("$install_dir/server/lib")) {
1248-
$command = "mkdir $install_dir/server/lib";
1249-
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1250-
}
1251-
1252-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
1253-
$content = str_replace('{hostname}', $conf['mysql']['host'], $content);
1254-
$content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
1255-
$content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
1256-
wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
1257-
exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
1258-
exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
1259-
1260-
}
1261-
1262-
public function install_crontab()
1263-
{
1264-
global $conf;
1265-
1266-
//* Root Crontab
1267-
exec('crontab -u root -l > crontab.txt');
1268-
$existing_root_cron_jobs = file('crontab.txt');
1269-
1270-
// remove existing ispconfig cronjobs, in case the syntax has changed
1271-
foreach($existing_root_cron_jobs as $key => $val) {
1272-
if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
1273-
}
1274-
1275-
$root_cron_jobs = array(
1276-
'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
1277-
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
1278-
);
1279-
1280-
if ($conf['nginx']['installed'] == true) {
1281-
$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
1282-
}
1283-
1284-
foreach($root_cron_jobs as $cron_job) {
1285-
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
1286-
$existing_root_cron_jobs[] = $cron_job."\n";
1287-
}
1288-
}
1289-
file_put_contents('crontab.txt', $existing_root_cron_jobs);
1290-
exec('crontab -u root crontab.txt &> /dev/null');
1291-
unlink('crontab.txt');
1292-
1293-
//* Getmail crontab
1294-
if(is_user('getmail')) {
1295-
$cf = $conf['getmail'];
1296-
exec('crontab -u getmail -l > crontab.txt');
1297-
$existing_cron_jobs = file('crontab.txt');
1298-
1299-
$cron_jobs = array(
1300-
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
1301-
);
1302-
1303-
// remove existing ispconfig cronjobs, in case the syntax has changed
1304-
foreach($existing_cron_jobs as $key => $val) {
1305-
if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
1306-
}
1307-
1308-
foreach($cron_jobs as $cron_job) {
1309-
if(!in_array($cron_job."\n", $existing_cron_jobs)) {
1310-
$existing_cron_jobs[] = $cron_job."\n";
1311-
}
1312-
}
1313-
file_put_contents('crontab.txt', $existing_cron_jobs);
1314-
exec('crontab -u getmail crontab.txt &> /dev/null');
1315-
unlink('crontab.txt');
1316-
}
1317-
1318-
exec('touch /var/log/ispconfig/cron.log');
1319-
exec('chmod 660 /var/log/ispconfig/cron.log');
1320-
}
1321-
13221236
}
13231237

13241238
?>

install/dist/lib/opensuse.lib.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,91 +1305,6 @@ public function install_ispconfig()
13051305

13061306
}
13071307

1308-
public function configure_dbserver()
1309-
{
1310-
global $conf;
1311-
1312-
//* If this server shall act as database server for client DB's, we configure this here
1313-
$install_dir = $conf['ispconfig_install_dir'];
1314-
1315-
// Create a file with the database login details which
1316-
// are used to create the client databases.
1317-
1318-
if(!is_dir("$install_dir/server/lib")) {
1319-
$command = "mkdir $install_dir/server/lib";
1320-
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1321-
}
1322-
1323-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
1324-
$content = str_replace('{hostname}', $conf['mysql']['host'], $content);
1325-
$content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
1326-
$content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
1327-
wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
1328-
exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
1329-
exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
1330-
1331-
}
1332-
1333-
public function install_crontab()
1334-
{
1335-
global $conf;
1336-
1337-
//* Root Crontab
1338-
exec('crontab -u root -l > crontab.txt');
1339-
$existing_root_cron_jobs = file('crontab.txt');
1340-
1341-
// remove existing ispconfig cronjobs, in case the syntax has changed
1342-
foreach($existing_root_cron_jobs as $key => $val) {
1343-
if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
1344-
}
1345-
1346-
$root_cron_jobs = array(
1347-
'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
1348-
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
1349-
);
1350-
1351-
if ($conf['nginx']['installed'] == true) {
1352-
$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
1353-
}
1354-
1355-
foreach($root_cron_jobs as $cron_job) {
1356-
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
1357-
$existing_root_cron_jobs[] = $cron_job."\n";
1358-
}
1359-
}
1360-
file_put_contents('crontab.txt', $existing_root_cron_jobs);
1361-
exec('crontab -u root crontab.txt &> /dev/null');
1362-
unlink('crontab.txt');
1363-
1364-
//* Getmail crontab
1365-
if(is_user('getmail')) {
1366-
$cf = $conf['getmail'];
1367-
exec('crontab -u getmail -l > crontab.txt');
1368-
$existing_cron_jobs = file('crontab.txt');
1369-
1370-
$cron_jobs = array(
1371-
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
1372-
);
1373-
1374-
// remove existing ispconfig cronjobs, in case the syntax has changed
1375-
foreach($existing_cron_jobs as $key => $val) {
1376-
if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
1377-
}
1378-
1379-
foreach($cron_jobs as $cron_job) {
1380-
if(!in_array($cron_job."\n", $existing_cron_jobs)) {
1381-
$existing_cron_jobs[] = $cron_job."\n";
1382-
}
1383-
}
1384-
file_put_contents('crontab.txt', $existing_cron_jobs);
1385-
exec('crontab -u getmail crontab.txt &> /dev/null');
1386-
unlink('crontab.txt');
1387-
}
1388-
1389-
exec('touch /var/log/ispconfig/cron.log');
1390-
exec('chmod 660 /var/log/ispconfig/cron.log');
1391-
}
1392-
13931308
}
13941309

13951310
?>

install/lib/installer_base.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,8 +2196,8 @@ public function install_crontab() {
21962196
}
21972197

21982198
$root_cron_jobs = array(
2199-
"* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
2200-
"* * * * * ".$install_dir."/server/cron.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
2199+
"* * * * * ".$install_dir."/server/server.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
2200+
"* * * * * ".$install_dir."/server/cron.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
22012201
);
22022202

22032203
if ($conf['nginx']['installed'] == true) {

0 commit comments

Comments
 (0)