0

I need to prevent termination of a critical process. A very annoying thing that happens is my VPS likes to kill processes it doesn't like when the RAM gets low. What ends up happening is this critical process gets killed first. This is very bad because the if the VPS IP cycles and the process gets killed, I am completely out of luck because the process can't connect to me and send the VPS's new external IP address.

I don't care if the killing is justifiable. I want to keep this process alive at all costs, and I don't care what measures I have to take. This process is the gateway to my system and I need it alive no matter what.

From comment: This process can not be killed. If this process is killed, consider my server completely inaccessible. This can not happen. I can't be expected to optimize services to not use RAM. The OS will still kill them if they use too much. But this one process is VERY IMPORTANT and must be kept alive at all costs.

1
  • 1
    Not possible unless you get your VPS to set this up. What you can do is the next best thing: make it respawn: askubuntu.com/questions/370957/… " This is very bad because the if the VPS IP cycles and the process gets killed, I am completely out of luck because the process can't connect to me and send the VPS's new external IP address." there should be ways around this too: make your process look for your new IP.
    – Rinzwind
    Commented Feb 5, 2017 at 10:51

1 Answer 1

0

Optimize the services running on your VPS to suit the RAM available or upgrade the available RAM to provide for the services.

You could resort to adjusting the oomkiller. See the accepted answer here Set OOM killer adjustment for process on startup?

6
  • This process can not be killed. If this process is killed, consider my server completely inaccessible. This can not happen. I can't be expected to optimize services to not use RAM. The OS will still kill them if they use too much. But this one process is VERY IMPORTANT and must be kept alive at all costs.
    – Dev
    Commented Feb 5, 2017 at 18:40
  • Yes, I read and understood that the first time. Then upgrade your VPS available RAM if you feel you cannot optimize your services to consume LESS RAM (where did I suggest they can consume no RAM?). You won't magically get more resources than the the system has available. The idea behind the link to the other answer is to make OTHER services that are less critical to be killed to free resources first making your critical service less likely to be killed.
    – user525027
    Commented Feb 5, 2017 at 19:34
  • Less likely to be killed? No, that will not work. This process MUST NOT BE KILLED. Everything else must be killed FIRST at all costs, no matter what. I do not want to take any risks.
    – Dev
    Commented Feb 5, 2017 at 20:09
  • I'm sorry if I'm being disrespectful. I would like to not worry about putting the RAM over 75% sometimes
    – Dev
    Commented Feb 6, 2017 at 2:43
  • In all honesty then you don't have enough RAM on your VPS to provide for what you expect it to do reliably. Add more RAM. If you really insist on not having the service killed you can try disabling the oomkiller on the critical service with for example pgrep -f “/usr/sbin/sshd” | while read PID; do echo -17 > /proc/$PID/oom_score_adj; done
    – user525027
    Commented Feb 6, 2017 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .