1if [ -r %{restart_flag} ] ; then
2  rm %{restart_flag}
3  # only restart the server if it was already running
4  if [ -x /usr/bin/systemctl ] ; then
5    /usr/bin/systemctl daemon-reload > /dev/null 2>&1
6    if /usr/bin/systemctl is-active mysql; then
7      /usr/bin/systemctl restart mysql > /dev/null 2>&1
8    else
9      /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
10    fi
11  # not a systemd-enabled environment, use SysV startup script
12  elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then
13    %{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1
14  fi
15fi
16