⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reset_right.sh

📁 Shell编程实例
💻 SH
字号:
#!/bin/bash 
###判断是否带有参数
if [ '$1'=='];
  then
echo –e '\33[om reboot.sh filename  \n  filename if  a file which cantain  thi  ip  list you  want  to reboot .\n]';
exit;
fi
###显示提示信息并读取passwd
echo –e '\33 [lm\33[5mwarning : \33 [om this script will reboot following gameserver 'more 41'
 if you  confire to  do this ,please input the server password. Otherwise, press ^c to abort the  script .'
read –p $USER@server password: -s  passwd
echo –e "\n"

###读入IP地址给变量host,用expect控制登录过程
for host in 'more $1 | grep '^[1-9]''
do 
   expect –c '
   set timeout 30;
   spawn /usr/bin/ssh $host ls –1;
   expect {
\'*yes/no*'{send \'yes\r';
exp_continue }
        \'*password*\'{send \'$passwd\r\';}
expect eof ;'
done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -