ssh - ksh 远程函数 ssh 调用另一个远程函数
问题描述
function test_me
{
sqlplus /nolog <<EOF
connect / as sysdba
oradebug dump systemstate 266
oradebug tracefile_name
EOF
}
function check_me
{
ssh ${HST2} "$(typeset -f); test_me"
}
ssh ${HST1} "$(typeset -f); check_me"
函数 test_me 的定义在 HST1 上看起来不错,但在 EOF 附近被截断为 HST2,失败并出现不匹配的 <<
有没有人解决这个问题?
解决方案
有两件事可以简化这一点:
- 使用
ProxyJump
选项让ssh
通过 HST1 处理与 HST2 的连接 - 通过标准输入提供脚本,
sqlplus
而不是尝试嵌入函数定义。
ssh -o ProxyJump=HST1 HST2 "sqlplus /nolog" <<EOF
connect / as sysdba
oradebug dump system state 266
oradebug tracefile_name
EOF
推荐阅读
- c - while循环的问题
- javascript - 查找数据库数据输入的平均值
- ios - 有没有办法在我的 PC 上以 iOS 模式测试我的 Ionic 应用程序?
- python - 基于另一个字符串迭代一个字符串
- java - How can I send a JsonObject request, and recieve a NodeResponse in the MeshRestClient?
- python - python - 如何根据python中同一数据集中的另外两个变量创建一个新变量?
- xml - 检查同一前缀中的多个 URI
- javascript - 删除对 Gatsby 的引用
- node.js - 我在 npm run build 期间发现了一个错误
- typescript - 当 S 扩展 T 时,Typescript 中的子类型和赋值兼容性