Automatically restart Webmin/Virtualmin in case of failure

Running out of memory sometimes happens on swap-less VPSes, and it seems Webmin (together with its twin, Virtualmin) are among the first processes to die in out-of-memory cases.

Setting up a little script to check for and restart Webmin if it is no longer running is a pretty simple (workaround) solution – but should never replace the proper procedure of adjusting the settings or upgrading the VPS to avoid running out of memory in the future.

Create /etc/webmin.chk with the following contents:

Mark the file as executable:

chmod +x /etc/webmin.chk

Then set up a cron task with the desired periodicity:

*/30 * * * * /etc/webmin.chk >/dev/null 2>&1

This script should work with both CentOS 6 and 7 (and the likes).

Leave a Reply