Page 1 of 1

I need to restart web server via cron

Posted: Fri Apr 03, 2020 6:14 am
by pipoy
Hi,

For some reason, these don't work via cron and even in crontab via root

sudo /usr/local/vesta/bin/v-restart-web
sudo service httpd restart

But if I manually run them on ssh, they work.

What am I missing?

Re: I need to restart web server via cron

Posted: Sat Apr 04, 2020 2:10 pm
by youradds
Hi,
sudo /usr/local/vesta/bin/v-restart-web
I'm not sure what that is supposed to do?

For "sudo service httpd restart", what is the exact cron you are using? I would set a custom mailto for that command - something like:

Code: Select all

[email protected]
@daily sudo service httpd restart
Then when it runs, you should get emailed the output (error message included)

Also, what server type are you using?

Hope that helps

Andy

Re: I need to restart web server via cron

Posted: Sat Apr 04, 2020 6:03 pm
by pipoy
youradds wrote:
Sat Apr 04, 2020 2:10 pm
Hi,
sudo /usr/local/vesta/bin/v-restart-web
I'm not sure what that is supposed to do?

For "sudo service httpd restart", what is the exact cron you are using? I would set a custom mailto for that command - something like:

Code: Select all

[email protected]
@daily sudo service httpd restart
Then when it runs, you should get emailed the output (error message included)

Also, what server type are you using?

Hope that helps

Andy

/bin/systemctl restart httpd.service seems to work on cron.

Reason being is I need to restart apache because my wordpress websites eat a lot of ram.
3 of them to be exact. But it only needs 1 wordpress to crash the system. For some reason, the 3 of them share the same resources. If I disable one of the website, RAM gets freed up.

Ram is 4gb

Restarting apache is my workaround until I come up a way to limit the ram usage for wordpress. But none of the solutions I have found works. This looks like another problem for not related to vesta. But if you can recommend something, I am all ears right here.

As my profile shows, I am running Centos7

Re: I need to restart web server via cron

Posted: Sun Apr 05, 2020 7:58 am
by youradds
Hi,

Probably not the answer you were hoping for - but you *really* should update your install Centos 7 is 2014 - so 6 years old. Its end of life is in a couple of months so you will be screwed. Not only will newer versions have better security, you should also find performance better.

Secondly - who do you host with? The type of server you use can also be an issue (I use Linode, and have never had any issues with performance - even with large sites)

Also - I'm more an Ubuntu user myself. Never really got into the other flavors (you stick with what you know :))

UPDATE: Oh, it seems that Centos 8 isn't yet officially supported by Vesta. You may want to look into Ubuntu 18.04 which I'm using on my servers now (I was on 16.04, but recently updated and its bloody awesome and fast!)

Cheers

Andy