当前位置: 技术问答>linux和unix
帮忙看看, 这个脚本的SSH命令为何在循环中永远只执行一次?
来源: 互联网 发布时间:2017-02-28
本文导语: 帮忙看看, 这个脚本的SSH命令为何在循环中永远只执行一次?谢谢! #!/bin/bash USER="cca" servers_filename="/cca/st_scripts/src/servers_app.txt" output_file="/cca/st_scripts/deletelogs/deletelog_app.log" date > $output_file echo "deleting logs for serv...
帮忙看看, 这个脚本的SSH命令为何在循环中永远只执行一次?谢谢!
#!/bin/bash
USER="cca"
servers_filename="/cca/st_scripts/src/servers_app.txt"
output_file="/cca/st_scripts/deletelogs/deletelog_app.log"
date > $output_file
echo "deleting logs for servers in $servers_filename ... "
while read SERVER
do
echo "$SERVER : deleting logs ..."
ssh $USER@$SERVER rm /mysqls/log/tmp/*.log
done
#!/bin/bash
USER="cca"
servers_filename="/cca/st_scripts/src/servers_app.txt"
output_file="/cca/st_scripts/deletelogs/deletelog_app.log"
date > $output_file
echo "deleting logs for servers in $servers_filename ... "
while read SERVER
do
echo "$SERVER : deleting logs ..."
ssh $USER@$SERVER rm /mysqls/log/tmp/*.log
done