I am trying to set up MariaDB in a way that it automatically recovers -- basically restarts, from a crash.

Based on this article -- scroll down to Auto-starting Services with systemd, I opened /etc/systemd/system/multi-user.target.wants/mariadb.service file but there were nothing like this as the article explains:


So I added the [Service] section and the Restart=always underneath, restarted the service and killed the process to see if it will start automatically, but it didn't.

I was wondering if I'm editing the wrong file or if there are other ways of achieving the same thing. Server is a remote machine running CentOS 7.

  • What signal has been used to stop the service? Try SIGSEGV. – sam_pan_mariusz Mar 21 '16 at 11:48
  • @sam_pan_mariusz kill -9 oh is that because it wasn't a crash it won't restart? – Mahdi Mar 21 '16 at 11:54
  • 1
    I've seen Upstart (the former init program in Ubuntu) not restarting certain services when they received SIGTERM, so I assumed a similar issue may exist with systemd. Other signals however worked as expected, SIGKILL (9) including. – sam_pan_mariusz Mar 21 '16 at 12:38
  • @sam_pan_mariusz thanks, I will try to see if there are similar solutions for Upstart that I can't apply on systemd. – Mahdi Mar 21 '16 at 13:06

After making changes to systemd units, you need to run systemctl daemon-reload for those changes to have effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.