Author Topic: How change the time of backups?  (Read 4619 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How change the time of backups?
« on: December 16, 2020, 11:29:47 PM »
Hello.

I search info about this, the backups (old module, not new beta backup) its executed at the same time.

I view this:
https://forum.centos-webpanel.com/index.php?topic=6840.0
Quote
crons jobs for backup are here :
/etc/cron.daily/cwp

you can modify according to your needs.
...
example:
0 3 * * * /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron.php
0 3 * * * /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php
If I edit the file /etc/cron.daily/cwp and add at the start line like above, not execute at the time and received, in the anacron info, a error in the lines of this file.

Any suggestion?

Thanks and regards!

Offline
*
Re: How change the time of backups?
« Reply #1 on: December 19, 2020, 06:18:30 AM »
by default cwp on install has already these crons configured so it is not clear what kind of issue do you have?
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: How change the time of backups?
« Reply #2 on: December 19, 2020, 11:07:13 AM »
Thanks for you reply!

Well, this crons, are executed at the time that (or same time in all servers)... I like preferer are executed ar other time with less work in the server.

What's my problem? That I am relatively new to CWP and I don't know how to change some aspects.

As I said in the first thread, I modified the files by adding the time to the beginning of the line, but as I imagined, it gives error (this error):
Quote
/etc/cron.daily/cwp:

/etc/cron.daily/cwp: line 1: 30: command not found
/etc/cron.daily/cwp: line 2: 30: command not found
Error because I am adding the time format to it but it is a php file and not a bash (I think so) and therefore it does not execute it.

I understand that maybe the anacron schedule should be changed, but I'm not sure ...

I just want to change the time of those checks to a better time for me, and I can't figure out how to do it ...

Thanks for your attention.

Edit: I comment the lines in  /etc/cron.daily/cwp
Quote
# /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron.php
# /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php

I execute first command in ssh:
Quote
/usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron.php
All perfect, the respond its good:
Quote
[root@server4 ~]# /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron.php


====================================================
============= CentOS Web Panel Cron ================
====================================================


###########################
Firewall Flush Daily Blocks
###########################


######################
Update Server Packages
######################
Redirecting to /bin/systemctl restart cwpsrv.service
Redirecting to /bin/systemctl restart httpd.service
Redirecting to /bin/systemctl reload httpd.service
Redirecting to /bin/systemctl reload httpd.service
I add this command in cron:
Quote
   20 12 * * * /usr/local/cwp/php71/bin/php -d max_execution_time=1000000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron.php
I have this email with error:
Quote
====================================================
============= CentOS Web Panel Cron ================
====================================================


###########################
Firewall Flush Daily Blocks
###########################


######################
Update Server Packages
######################
Redirecting to /bin/systemctl restart cwpsrv.service
/scripts/cpanel_addhandlers: line 161: service: command not found
sh: service: command not found
sh: line 2: service: command not found

But not with the line of backup (also I added in cron) this result is good.

I don't understand what, if I execute first line in ssh, work good, if its executed in cron, I have this mail with error...
« Last Edit: December 19, 2020, 11:29:33 AM by Wonder »

Offline
*
Re: How change the time of backups?
« Reply #3 on: December 21, 2020, 10:25:55 AM »
"Middle" solved.

I changed the hours work in anacrontab and start, more or less, at the time that I want.

But I think that, its good iddea can change the time of this works.