Automatically restart Webmin/Virtualmin in case of failure

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:


if /sbin/service webmin status | grep "stopped" >/dev/null
    echo "Webmin is stopped. Restarting..."
    /sbin/service webmin start
    echo "Webmin is running."

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

One comment

  1. Thanks for this useful article
    I have a few sites that use my wordpress infrastructure
    I manage them using centos7 / Webmin-Virtualmin.
    but my sites constantly “MySQL Database Server” stops or “BIND DNS Server” stops coming to trouble. When you stop them, you can do what to start automatically.


Leave a Reply