New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

How change the time of backups?

Started by Wonder, December 16, 2020, 11:29:47 PM

Previous topic - Next topic

Wonder

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!

studio4host

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.

Wonder

#2
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:
Quote20 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...

Wonder

"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.