我用公钥(无密码)在服务器上用ssh登录。
这是我想用一个bash以使自动化命令:
用ssh和本地脚本一起执行远程bash,当它结束时,将终止远程执行
ssh [email protected]
cd path
./bash0.sh parameter1 paramter2 & <-- this is a loop and is working on remote server in background
exit <-- exit form ssh
./bash1.sh <-- starting local bash
ssh [email protected] pkill bash0.sh <-- kill the process at the end of the bash1.sh. From terminal is ok, but from bash?
的问题是执行cd path
后,立即从SSH的./bash0.sh paramter1 parameter2 &
,然后退出,而不用等待./bash0.sh
完成。我不能做ssh [email protected] ./path/bash0.sh paramter1 paramter2
因为bash文件包含相对路径。
'ssh user @ ip pkill bash0.sh'似乎可行,但我已经正确启动'。/ bash0.sh',然后以更好的方式测试杀死进程。 – user1382278 2013-03-05 21:28:51