switch the »current« symlink in an atomic way

This commit is contained in:
Stefan Paletta
2015-01-09 17:27:14 +01:00
parent 683d11ac90
commit 4e17263773
2 changed files with 8 additions and 5 deletions
+4 -2
View File
@@ -127,9 +127,11 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$userGroup = '';
$resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
$command = 'rm -f ' . $symlink
$tmplink = $rollbackTo . '.tmp';
$command = 'ln -sfn ' . $currentCopy . ' ' . $tmplink
. ' && '
. 'ln -sf ' . $rollbackTo . ' ' . $symlink;
. 'mv -T ' . $tmplink . ' ' . $symlink;
if ($resultFetch) {
$command .= ' && chown -h ' . $userGroup . ' ' . $symlink;