• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Is there a way to restart the server automatically every time it crashes due to 2GB of RAM?

Carlos Nog

New Pleskian
Server operating system version
Ubuntu 22.05
Plesk version and microupdate number
18.0.56
hello,

Is there a way to restart the server automatically every time it crashes due to 2GB of RAM?
 
Its not Plesk that is crashing its your server running out of ram. Fix the RAM issue.
 
What @Dave W is true, but if you need something, this might help:

- Log in on your server using SSH
- Add these two lines to /etc/sysctl.conf
Code:
vm.panic_on_oom=1   ; enables panic on OOM
kernel.panic=10     ; tells the kernel to reboot ten seconds after panicking

When your server runs out of RAM, the server will reboot after 10 seconds.
I haven't tested this, so use it with care.
 
I have 5 wordpress sites. And yesterday without having opened the plesk panel and without having been working on the wordpress sites, the server went down.
They have very little traffic.
2GB RAM
80GB SSD
 
Did you check the /var/log/syslog after the reboot? Was there anything related to a system crash like "oom" (Out Of Memory)?
Could it be a fail2ban action that blocked you from the server?

I'm just curious why you think the server ran out of memory or crashed.
 
Hi Carlos, what Peter Debik says resonates with what I heard from Plesk Technical Support recommendations.

I did have a similar experience, server running out of memory, and I added swap and it seems to help my situation.
1703090160234.png
 
Hi Carlos, what Peter Debik says resonates with what I heard from Plesk Technical Support recommendations.

I did have a similar experience, server running out of memory, and I added swap and it seems to help my situation.
View attachment 25104
hello. I have Ubuntu 22.04 and I want to add 4GB of RAM SWAP.

How did you do it? if you log in using ssh. but what commands did you use?
 
Hi Carlos, I logged to the server and executed the following commands, if use the SSH terminal on Plesk you could do it too.


Create a New Swap File (if needed):


  • If you don't have an existing swap file, create one using fallocate:
    Bash
    sudo fallocate -l 4G /swapfile

    Use code with caution.
    • Replace 4G with the desired swap size (e.g., 8G for 8GB).
Set up the Swap File:


  • Make the swap file usable with mkswap:

    sudo mkswap /swapfile


  • Enable the swap file:

    sudo swapon /swapfile

Make the Change Permanent:


  • Edit the /etc/fstab file to mount the swap file automatically at boot:

    sudo nano /etc/fstab

  • Add this line to the end:
    /swapfile swap swap defaults 0 0

5. Adjust Swappiness (Optional):


  • Control how often the system uses swap:

    sudo sysctl vm.swappiness=10

    • Values closer to 0 mean less frequent swap usage, while values closer to 100 mean more frequent use.

6. Verify the Changes:


  • Use free -m again to confirm the increased swap space.

More information:
 
What @Dave W is true, but if you need something, this might help:

- Log in on your server using SSH
- Add these two lines to /etc/sysctl.conf
Code:
vm.panic_on_oom=1   ; enables panic on OOM
kernel.panic=10     ; tells the kernel to reboot ten seconds after panicking

When your server runs out of RAM, the server will reboot after 10 seconds.
I haven't tested this, so use it with care.
This is probably a vserver, so would this even work?
 
Hi Carlos, I logged to the server and executed the following commands, if use the SSH terminal on Plesk you could do it too.


Create a New Swap File (if needed):


  • If you don't have an existing swap file, create one using fallocate:
    Bash
    sudo fallocate -l 4G /swapfile

    Use code with caution.
    • Replace 4G with the desired swap size (e.g., 8G for 8GB).
Set up the Swap File:


  • Make the swap file usable with mkswap:

    sudo mkswap /swapfile


  • Enable the swap file:

    sudo swapon /swapfile
Make the Change Permanent:


  • Edit the /etc/fstab file to mount the swap file automatically at boot:

    sudo nano /etc/fstab

  • Add this line to the end:
    /swapfile swap swap defaults 0 0

5. Adjust Swappiness (Optional):


  • Control how often the system uses swap:

    sudo sysctl vm.swappiness=10
    • Values closer to 0 mean less frequent swap usage, while values closer to 100 mean more frequent use.

6. Verify the Changes:


  • Use free -m again to confirm the increased swap space.

More information:
Hello, thank you for your great help. I have done everything as you explained. I hope it works well for me now. I sent a screenshot there. Thank you
 

Attachments

  • Captura desde 2023-12-23 16-20-20.png
    Captura desde 2023-12-23 16-20-20.png
    97.7 KB · Views: 7
Back
Top