Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISPConfig
ISPConfig 3
Commits
6495dda1
Commit
6495dda1
authored
Oct 13, 2015
by
Marius Cramer
Browse files
- fixed daily backup
parent
cedad166
Changes
1
Show whitespace changes
Inline
Side-by-side
server/lib/classes/cron.d/500-backup.inc.php
View file @
6495dda1
...
...
@@ -117,12 +117,12 @@ class cronjob_backup extends cronjob {
if
(
$backup_mode
==
'userzip'
)
{
//* Create a .zip backup as web user and include also files owned by apache / nginx user
$web_backup_file
=
'web'
.
$web_id
.
'_'
.
date
(
'Y-m-d_H-i'
)
.
'.zip'
;
exec
(
'cd '
.
escapeshellarg
(
$web_path
)
.
' && sudo -u '
.
escapeshellarg
(
$web_user
)
.
' find . -group '
.
escapeshellarg
(
$web_group
)
.
' -print 2> /dev/null | zip -b /tmp --exclude=backup\*'
.
$backup_excludes
.
' --symlinks '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' -@'
,
$tmp_output
,
$retval
);
if
(
$retval
==
0
||
$retval
==
12
)
exec
(
'cd '
.
escapeshellarg
(
$web_path
)
.
' && sudo -u '
.
escapeshellarg
(
$web_user
)
.
' find . -user '
.
escapeshellarg
(
$http_server_user
)
.
' -print 2> /dev/null | zip -b /tmp --exclude=backup\*'
.
$backup_excludes
.
' --update --symlinks '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' -@'
,
$tmp_output
,
$retval
);
exec
(
'cd '
.
escapeshellarg
(
$web_path
)
.
' && sudo -u '
.
escapeshellarg
(
$web_user
)
.
' find . -group '
.
escapeshellarg
(
$web_group
)
.
' -print 2> /dev/null | zip -b /tmp --exclude=
./
backup\*'
.
$backup_excludes
.
' --symlinks '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' -@'
,
$tmp_output
,
$retval
);
if
(
$retval
==
0
||
$retval
==
12
)
exec
(
'cd '
.
escapeshellarg
(
$web_path
)
.
' && sudo -u '
.
escapeshellarg
(
$web_user
)
.
' find . -user '
.
escapeshellarg
(
$http_server_user
)
.
' -print 2> /dev/null | zip -b /tmp --exclude=
./
backup\*'
.
$backup_excludes
.
' --update --symlinks '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' -@'
,
$tmp_output
,
$retval
);
}
else
{
//* Create a tar.gz backup as root user
$web_backup_file
=
'web'
.
$web_id
.
'_'
.
date
(
'Y-m-d_H-i'
)
.
'.tar.gz'
;
exec
(
'tar pczf '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' --exclude=backup\*'
.
$backup_excludes
.
' --directory '
.
escapeshellarg
(
$web_path
)
.
' .'
,
$tmp_output
,
$retval
);
exec
(
'tar pczf '
.
escapeshellarg
(
$web_backup_dir
.
'/'
.
$web_backup_file
)
.
' --exclude=
./
backup\*'
.
$backup_excludes
.
' --directory '
.
escapeshellarg
(
$web_path
)
.
' .'
,
$tmp_output
,
$retval
);
}
if
(
$retval
==
0
||
(
$backup_mode
!=
'userzip'
&&
$retval
==
1
)
||
(
$backup_mode
==
'userzip'
&&
$retval
==
12
))
{
// tar can return 1, zip can return 12(due to harmless warings) and still create valid backups
if
(
is_file
(
$web_backup_dir
.
'/'
.
$web_backup_file
)){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment