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 a file, for example /etc/webmin.check with the following contents:
#!/bin/bash if /sbin/service webmin status | grep "stopped" >/dev/null then echo "Webmin is stopped. Restarting..." /sbin/service webmin restart else echo "Webmin is running." fi
If your system uses systemd use this instead:
#!/bin/bash if /bin/systemctl status webmin.service | grep "stopped\|failed\|inactive" >/dev/null then echo "Webmin is stopped. Restarting..." /bin/systemctl restart webmin else echo "Webmin is running." fi
Mark the file as executable:
chmod +x /etc/webmin.check
Then set up a cron task with the desired periodicity (in this example every 30 minutes):
*/30 * * * * /etc/webmin.check >/dev/null 2>&1
Alternatively, reverse the check to treat all not running cases as failure:
#!/bin/bash if /bin/systemctl status webmin.service | grep "running" >/dev/null then echo "Webmin is running." else echo "Webmin is stopped. Restarting..." /bin/systemctl restart webmin fi
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.