当前位置:网站首页>Shell常用脚本:判断远程主机的文件是否存在
Shell常用脚本:判断远程主机的文件是否存在
2022-07-25 12:41:00 【嗯嗯**】
remoteFileTest.sh
#/bin/bash
# 使用此脚本前必须在本机运行 【ssh-keygen】生成公私密钥文件,然后用【ssh-copy-id -i 本机公钥文件 远程用户名@远程IP】将本机公钥给远程主机
#
remoteIp=$1
remoteFile=$2
echo "入参1:${remoteIp}"
echo "入参2:${remoteFile}"
if [[ -n ${remoteIp} && -n ${remoteFile} ]]; then
if (ssh [email protected]${remoteIp} test -e ${remoteFile});then
echo "存在文件${remoteFile}在远程主机${remoteIp}中"
else
echo "不存在文件${remoteFile}在远程主机${remoteIp}中"
fi
else
echo "用法: sh $0 远程主机IP 远程主机文件的绝对路径"
fi

边栏推荐
- Table partition of MySQL
- LeetCode 0133. 克隆图
- If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
- Want to go whoring in vain, right? Enough for you this time!
- [problem solving] org.apache.ibatis.exceptions PersistenceException: Error building SqlSession. 1-byte word of UTF-8 sequence
- 485 communication (detailed explanation)
- "Autobiography of Franklin" cultivation
- 业务可视化-让你的流程图'Run'起来(3.分支选择&跨语言分布式运行节点)
- Jenkins configuration pipeline
- Zero basic learning canoe panel (14) -- led control and LCD control
猜你喜欢

弹性盒子(Flex Box)详解

ECCV2022 | TransGrasp类级别抓取姿态迁移

Detailed explanation of flex box

想要白嫖正则大全是吧?这一次给你个够!

跌荡的人生

Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network

零基础学习CANoe Panel(12)—— 进度条(Progress Bar)

485通讯( 详解 )

clickhouse笔记03-- Grafana 接入ClickHouse

Azure Devops (XIV) use azure's private nuget warehouse
随机推荐
2022.07.24(LC_6125_相等行列对)
2022.07.24 (lc_6125_equal row and column pairs)
[high concurrency] deeply analyze the execution process of worker threads in the thread pool through the source code
ECCV2022 | TransGrasp类级别抓取姿态迁移
go : gin 自定义日志输出格式
软件测试流程包括哪些内容?测试方法有哪些?
logstash
Kyligence was selected into Gartner 2022 data management technology maturity curve report
感动中国人物刘盛兰
More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural
Software testing interview question: Please list the testing methods of several items?
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
【AI4Code】《GraphCodeBERT: Pre-Training Code Representations With DataFlow》 ICLR 2021
什么是CI/CD?
Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告
mysql有 flush privileges 吗
Detailed explanation of flex box
Deployment of Apache website services and implementation of access control
AtCoder Beginner Contest 261E // 按位思考 + dp
Deep learning MEMC framing paper list