mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
优化自动安装的MySQL服务
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
@@ -569,6 +570,12 @@ func (this *MySQLInstaller) installService(baseDir string) error {
|
|||||||
|
|
||||||
this.log("registering systemd service ...")
|
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
|
var desc = `### BEGIN INIT INFO
|
||||||
# Provides: mysql
|
# Provides: mysql
|
||||||
# Required-Start: $local_fs $network $remote_fs
|
# Required-Start: $local_fs $network $remote_fs
|
||||||
@@ -589,7 +596,8 @@ After=network-online.target
|
|||||||
Type=simple
|
Type=simple
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
ExecStart=${BASE_DIR}/support-files/mysql.server start
|
RemainAfterExit=yes
|
||||||
|
ExecStart=` + startCmd + `
|
||||||
ExecStop=${BASE_DIR}/support-files/mysql.server stop
|
ExecStop=${BASE_DIR}/support-files/mysql.server stop
|
||||||
ExecRestart=${BASE_DIR}/support-files/mysql.server restart
|
ExecRestart=${BASE_DIR}/support-files/mysql.server restart
|
||||||
ExecStatus=${BASE_DIR}/support-files/mysql.server status
|
ExecStatus=${BASE_DIR}/support-files/mysql.server status
|
||||||
|
|||||||
Reference in New Issue
Block a user