大螃嗨

好记性不如烂笔头

用户工具

站点工具


文件存在验证

Linux下检测服务器上指定文件是否存在

#!/bin/bash
name=$1
ssh_host="10.10.10.10"
file="/var/www/domain.io/static/img/"$name
if ssh $ssh_host test -e $file;  
    then echo $ssh_host $file exists!  
    else echo $ssh_host $file DOES NOT EXIST!
fi
 
ssh_host="11.11.11.11"
file="/var/www/domain.io/static/img/"$name
if ssh $ssh_host test -e $file;  
    then echo $ssh_host $file exists!
    else echo $ssh_host $file DOES NOT EXIST!
fi
文件存在验证.txt · 最后更改: 2019/03/19 06:31 由 螃蟹