shell脚本---停止、启动、重启网卡

文件名:

test.sh

#!/bin/bash
service network stop
#延迟300秒后在执行启动网卡的操作
sleep 800
service network start
echo "hello,world!"

 

Linux命令

service network stop/start 关闭 or 启动

service network restart 重启

 

rz 命令工具安装命令

yum -y install lrzsz

shell文件执行步骤:

1、将脚本上传到服务器(cd 到相应目录)

2、chmod +x ./test.sh #使脚本具有执行权限

 3、./test.sh #执行脚本

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章