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 #執行腳本

 

 

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