From 2c80bdefcfd674ca04b483524c4f70dc7fbb2c92 Mon Sep 17 00:00:00 2001 From: Jrohy Date: Tue, 3 Mar 2020 23:45:39 +0800 Subject: [PATCH] Fix bug --- asset/docker_tip.txt | 7 +++++-- asset/trojan-install.sh | 2 +- cmd/version.go | 2 +- trojan/install.go | 6 ++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/asset/docker_tip.txt b/asset/docker_tip.txt index 65c6da29..86ebc484 100644 --- a/asset/docker_tip.txt +++ b/asset/docker_tip.txt @@ -1,3 +1,6 @@ -docker 运行 -docker run -it -d --name trojan --net=host --restart=always --privileged -v /var/run/docker.sock:/var/run/docker.sock -v `which docker`:`which docker` jrohy/trojan +mysql 运行 +docker run --name trojan-mysql --restart=always -p 3306:3306 -v /home/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=trojan -e MYSQL_ROOT_HOST=% -e MYSQL_DATABASE=trojan -d mysql/mysql-server:5.7 + +trojan 运行 +docker run -it -d --name trojan --net=host --restart=always --privileged jrohy/trojan init diff --git a/asset/trojan-install.sh b/asset/trojan-install.sh index 27bca24d..b534f348 100644 --- a/asset/trojan-install.sh +++ b/asset/trojan-install.sh @@ -58,7 +58,7 @@ else echo Skipping installing $NAME server config... fi -if [[ ! -e "/.dockerenv" && -d "$SYSTEMDPREFIX" ]]; then +if [[ -d "$SYSTEMDPREFIX" ]]; then echo Installing $NAME systemd service to $SYSTEMDPATH... if ! [[ -f "$SYSTEMDPATH" ]] || prompt "The systemd service already exists in $SYSTEMDPATH, overwrite?"; then cat > "$SYSTEMDPATH" << EOF diff --git a/cmd/version.go b/cmd/version.go index 8452b52a..bdb15e59 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -22,7 +22,7 @@ import ( "github.com/spf13/cobra" ) -const VERSION = "v1.3.0" +const VERSION = "v1.3.1" // versionCmd represents the version command var versionCmd = &cobra.Command{ diff --git a/trojan/install.go b/trojan/install.go index 55c2ed4c..b4e83361 100644 --- a/trojan/install.go +++ b/trojan/install.go @@ -46,10 +46,8 @@ func InstallTrojan() { fmt.Println(err) } util.ExecCommand(data) - if !util.IsExists("/.dockerenv") { - util.ExecCommand("systemctl restart trojan") - util.ExecCommand("systemctl enable trojan") - } + util.ExecCommand("systemctl restart trojan") + util.ExecCommand("systemctl enable trojan") util.OpenPort(443) fmt.Println() }