linux下带.d的文件夹,linux – 如何在shell脚本中包含目录中的所有文件(在本例中为/etc/init.d/iptables)...
我在不同的ubuntu服務(wù)器上有一個/etc/init.d/iptables start | stop | restart腳本(這是一個普通的
shell腳本)
對于每個新服務(wù),我必須編輯并插入一行來打開一個端口.這導(dǎo)致在不同的機(jī)器上有許多不同版本的init.d腳本.
是否可以自動包含讓我們說/etc/iptables/include.d/中的所有文件?
目標(biāo)是/etc/init.d/iptables的啟動函數(shù)中只應(yīng)該有一行代碼
include /etc/iptables/include.d/*
在/etc/iptables/include.d/中添加了一個額外的文件后,我只想說
/etc/init.d/iptables restart
編輯:正如Saurabh所指出的那樣,當(dāng)命令需要某個命令時,這會導(dǎo)致問題.高級設(shè)置可能有不同的目錄,如:
/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/*
總結(jié)
以上是生活随笔為你收集整理的linux下带.d的文件夹,linux – 如何在shell脚本中包含目录中的所有文件(在本例中为/etc/init.d/iptables)...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021年水环境综合整治方案3篇
- 下一篇: linux网卡设置详解,史上最详细的Li