Skip to content

Commit 3fb802e

Browse files
author
Till Brehm
committed
Fixed: FS#3509 - Apache log directory not unmounted when moving site
1 parent b5b8626 commit 3fb802e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ function update($event_name, $data) {
461461
$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
462462
$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
463463
}
464+
465+
//* Unmount the old log directory bfore we move the log dir
466+
exec('umount '.escapeshellcmd($old_dir.'/log'));
464467

465468
//* Create new base directory, if it does not exist yet
466469
if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
@@ -492,6 +495,8 @@ function update($event_name, $data) {
492495
$app->system->removeLine('/etc/fstab', $fstab_line);
493496
$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
494497
$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
498+
499+
exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
495500

496501
}
497502

server/plugins-available/nginx_plugin.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ function update($event_name, $data) {
465465
$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
466466
$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
467467
}
468+
469+
//* Unmount the old log directory bfore we move the log dir
470+
exec('umount '.escapeshellcmd($old_dir.'/log'));
468471

469472
//* Create new base directory, if it does not exist yet
470473
if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
@@ -496,6 +499,8 @@ function update($event_name, $data) {
496499
$app->system->removeLine('/etc/fstab', $fstab_line);
497500
$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
498501
$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
502+
503+
exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
499504

500505
}
501506

0 commit comments

Comments
 (0)