From ca0d23947cb72335af58a4cac4cb1acc6b690549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylv=C3=A8re=20Gr=C3=A9geois?= Date: Thu, 23 May 2019 10:52:48 +0200 Subject: [PATCH] do not kill server if it is running --- sshcode.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sshcode.go b/sshcode.go index a31e3d8..1c21f14 100644 --- a/sshcode.go +++ b/sshcode.go @@ -344,14 +344,16 @@ func rsync(src string, dest string, sshFlags string, excludePaths ...string) err func downloadScript(codeServerPath string) string { return fmt.Sprintf( `set -euxo pipefail || exit 1 - -pkill -f %v || true -mkdir -p ~/.local/share/code-server %v -cd %v -wget -N https://codesrv-ci.cdr.sh/latest-linux -[ -f %v ] && rm %v -ln latest-linux %v -chmod +x %v`, +isRunning=$(ps aux | grep sshcode-server) +if [ -z "$isRunning" ]; then + pkill -f %v || true + mkdir -p ~/.local/share/code-server %v + cd %v + wget -N https://codesrv-ci.cdr.sh/latest-linux + [ -f %v ] && rm %v + ln latest-linux %v + chmod +x %v +fi`, codeServerPath, filepath.Dir(codeServerPath), filepath.Dir(codeServerPath),