This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Old issue on Daily Backup
#3
RE: Old issue on Daily Backup
From the link above: ( http://www.robgroen.nl/content/zpanel-cr...ps-one-day )
Pasted here in case something happens on that site. I will also test out the code and push the changes to github if successful.
Quote:ZPanel creates multiple backups on one day
Suddenly my ZPanel began making multiple backups on one day. Looking at the filename of the backup it looks like the backups are made 1 sec after another.
Backup has file names like this

Code:
zadmin_Oct-18-2014_051006.zip
zadmin_Oct-18-2014_051007.zip
zadmin_Oct-18-2014_051008.zip


Actually the file are not made 1 sec after another but 5 minutes. Looking at the file system in the backup directories confirm that. So why is the filename telling me something others than that? There is a bug in the script that defines the filename.

Minutes
Using the date php date format character hms is not hour minute seconds but hours month seconds So changing the "m" into a "i" gives you the minutes.
Hour
Also the hours are wrong defined "h" gives me the 01-12 hour definition without AM or PM. So i think 00-23 in this case is better. Change the "h" into a "H" for 24 hour definition in the time.
Seconds
Seconds "s" is OK

Code:
cd /etc/zpanel/panel/modules/backup_admin/hook
cp OnDaemonDay.hook.php  OnDaemonDay.hook.php.$(date +%Y%m%d-%H%m%S)
vi OnDaemonDay.hook.php


Change line 34 from

Code:
$backupname = $username . "_" . date("M-d-Y_hms", time());


to

Code:
$backupname = $username . "_" . date("M-d-Y_His", time());


Actually I suppose the multi backup issue is triggered if the total time that is takes to make all backups is longer than the pauses between two cron deamon jobs (default is 5 minutes). This problem is created in /etc/zpanel/panel/bin/daemon.php The dayrun takes more takes 5 minutes and the time is reset after all three jobs are done.
I changes this code to:

Code:
if (ctrl_options::GetSystemOption('daemon_dayrun') < (time() - 86399)) {
    runtime_hook::Execute("OnStartDaemonDay");
    runtime_hook::Execute("OnDaemonDay");
    runtime_hook::Execute("OnEndDaemonDay");
    ctrl_options::SetSystemOption('daemon_dayrun', time());
}


This:

Code:
if (ctrl_options::GetSystemOption('daemon_dayrun') < (time() - 86399)) {
    ctrl_options::SetSystemOption('daemon_dayrun', time());
    runtime_hook::Execute("OnStartDaemonDay");
    runtime_hook::Execute("OnDaemonDay");
    runtime_hook::Execute("OnEndDaemonDay");
}


Just moved the line ctrl_options::SetSystemOption('daemon_dayrun', time()); up three lines.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:


Messages In This Thread
Old issue on Daily Backup - by iraqiboy90 - 06-30-2015, 05:22 AM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-01-2015, 11:16 AM
RE: Old issue on Daily Backup - by TGates - 07-01-2015, 12:54 PM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-19-2015, 08:12 AM
RE: Old issue on Daily Backup - by TGates - 07-21-2015, 10:48 PM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-23-2015, 12:10 PM
RE: Old issue on Daily Backup - by TGates - 07-24-2015, 12:33 AM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-24-2015, 02:42 AM
RE: Old issue on Daily Backup - by TGates - 07-24-2015, 08:46 AM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-25-2015, 07:52 AM
RE: Old issue on Daily Backup - by iraqiboy90 - 07-26-2015, 12:52 PM
RE: Old issue on Daily Backup - by iraqiboy90 - 12-15-2015, 05:34 AM
RE: Old issue on Daily Backup - by TGates - 12-15-2015, 04:25 PM
RE: Old issue on Daily Backup - by iraqiboy90 - 12-18-2015, 08:28 AM
RE: Old issue on Daily Backup - by iraqiboy90 - 12-18-2015, 10:18 AM
RE: Old issue on Daily Backup - by laverneplab - 09-02-2016, 06:08 PM
RE: Old issue on Daily Backup - by changgrover - 08-07-2017, 10:15 PM
RE: Old issue on Daily Backup - by Alex Lewis - 12-01-2017, 09:20 PM
RE: Old issue on Daily Backup - by djamessmith8 - 05-19-2018, 10:07 PM
RE: Old issue on Daily Backup - by TGates - 05-21-2018, 05:24 AM
RE: Old issue on Daily Backup - by republicus - 10-26-2018, 09:27 AM
RE: Old issue on Daily Backup - by fearworks - 10-26-2018, 12:43 PM
RE: Old issue on Daily Backup - by republicus - 10-26-2018, 03:14 PM
RE: Old issue on Daily Backup - by fearworks - 10-26-2018, 07:33 PM
RE: Old issue on Daily Backup - by conglynina - 12-26-2020, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Security issue urgent johnnyp 7 12 ,863 02-27-2020, 06:19 PM
Last Post: johnnyp
Restore mysql database backup to new Sentora kevwebbie 3 8 ,342 09-30-2019, 09:50 PM
Last Post: kevwebbie
sub-domain issue kevwebbie 15 30 ,452 12-21-2018, 05:51 PM
Last Post: kevwebbie

Forum Jump:


Users browsing this thread: 3 Guest(s)