私はgo exec sshを使用してリモートサーバ上の "tail -f"を実行します。プロセスを終了しますが、 "tail -f"リモートサーバーで実行します。 リモートサーバで "tail -f"を実行するにはどうすればよいですか? コードは以下の通りです。 excete sshコマンドを実行し、リモートサーバ上のコマンドをkillすることはできません
package main
import (
"os/exec"
"github.com/astaxie/beego"
"time"
)
func main() {
var cmd = exec.Command("ssh","-t", "-p", "9122","[email protected]" ,"tail -f /log.out")
var err error
cmd.Start()
time.Sleep(time.Second*5)
err = cmd.Process.Kill() // when I killed this Process. The remote server [email protected] still run 'tail -f /log.out'
beego.Error(err)
}