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),