linux下带.d的文件夹,linux – 如何在shell脚本中包含目录中的所有文件(在本例中为/etc/init.d/iptables)...
我在不同的ubuntu服務器上有一個/etc/init.d/iptables start | stop | restart腳本(這是一個普通的
shell腳本)
對于每個新服務,我必須編輯并插入一行來打開一個端口.這導致在不同的機器上有許多不同版本的init.d腳本.
是否可以自動包含讓我們說/etc/iptables/include.d/中的所有文件?
目標是/etc/init.d/iptables的啟動函數中只應該有一行代碼
include /etc/iptables/include.d/*
在/etc/iptables/include.d/中添加了一個額外的文件后,我只想說
/etc/init.d/iptables restart
編輯:正如Saurabh所指出的那樣,當命令需要某個命令時,這會導致問題.高級設置可能有不同的目錄,如:
/etc/iptables/include01.d/
/etc/iptables/include02.d/
/etc/iptables/include03.d/
包括他們像這樣:
include /etc/iptables/include01.d/*
... maybe some code goes here in the main file...
include /etc/iptables/include02.d/*
include /etc/iptables/include03.d/*
總結
以上是生活随笔為你收集整理的linux下带.d的文件夹,linux – 如何在shell脚本中包含目录中的所有文件(在本例中为/etc/init.d/iptables)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021年水环境综合整治方案3篇
- 下一篇: 幼儿舞蹈创编教案一等奖