我有一个测试sh脚本,我可以在我的计算机上运行,如果一切正常的话,它不会产生任何输出。我使用scp将正在工作的文件夹中的所有内容传输到远程服务器,当我在远程服务器上运行它时,会得到以下错误
egrep: Unmatched ) or \)
egrep: Unmatched ) or \)
./script.sh: line 229: ./helperScripts/script2.pl: No such file or directory
我没有在我的计算机上看到这些错误,当我检查它在helperScripts中时,它就在那里
当我在远程服务器上运行sh -version时,
GNU bash
如何将Ctrl-C ssh -t 发送到 Popen() 对象中的多个进程?
我有一些Python代码可以在远程主机上启动一个脚本:
# kickoff.py
# i call 'ssh' w/ the '-t' flag so that when i press 'ctrl-c', it get's
# sent to the script on the remote host. otherwise 'ctrol-c' would just
# kill things on this end, and the scr
我希望编写一个简单的脚本,以便在许多主机上同时执行SSH命令,而哪些主机正是从另一个脚本中生成的。问题是,当我使用sed这样的工具运行脚本时,它不能正常工作。
它应该像sshall.sh {anything here}一样运行,并且它将在列表中的所有节点上运行{anything here}部件。
sshall.sh
#!/bin/bash
NODES=`listNodes | grep "node-[0-9*]" -o`
echo "Connecting to all nodes and running: ${@:1}"
for i in $NODES
d
我想运行一个不结束的脚本,并且只想在远程节点上看到输出。这有可能吗?
也许像这样:
---
- hosts: server
gather_facts: False
tasks:
- name: Run runserver.sh and save the output of script
shell: screen -dRR bash /home/dell/tester_server_2/runserver.sh
async: 99999999999
poll: 0
尽管远程虚拟机上的top命令显示脚本已开始运行,但这并不是打开新的screen会话
我还尝试
我正在尝试从脚本在几个不同的主机上运行远程二进制文件,这是有意义的,它能够在各自的主机中启动它们中的每一个,并在退出之前等待所有这些远程ssh命令。我的尝试是这样的:
for host in A B C
do
ssh user@$host "
function test
{
cd /path/to/foo
./foo_exe --optA > run.out 2>&1
}; test &
done
wait
不幸的是,这似乎是按顺序运行的,首先在主机A上运行,然后在B etc..why上运行。