From 023c4bb9caff248a1b2d5ce7cf015bd06718cc0a Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 8 Mar 2024 20:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E7=9A=84MySQL=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setup/mysql/mysqlinstallers/mysql_installer.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go index 21506f77..b48362d2 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go @@ -15,6 +15,7 @@ import ( "net" "net/http" "os" + "os/exec" "path/filepath" "regexp" "runtime" @@ -569,6 +570,12 @@ func (this *MySQLInstaller) installService(baseDir string) error { this.log("registering systemd service ...") + var startCmd = "${BASE_DIR}/support-files/mysql.server start" + bashPath, _ := exec.LookPath("bash") + if len(bashPath) > 0 { + startCmd = bashPath + " -c \"" + startCmd + "\"" + } + var desc = `### BEGIN INIT INFO # Provides: mysql # Required-Start: $local_fs $network $remote_fs @@ -589,7 +596,8 @@ After=network-online.target Type=simple Restart=on-failure RestartSec=5s -ExecStart=${BASE_DIR}/support-files/mysql.server start +RemainAfterExit=yes +ExecStart=` + startCmd + ` ExecStop=${BASE_DIR}/support-files/mysql.server stop ExecRestart=${BASE_DIR}/support-files/mysql.server restart ExecStatus=${BASE_DIR}/support-files/mysql.server status