linux network 脚本,linux – 当接口出现时,每个脚本都位于/etc/network/if-up.d中吗?

这篇博客详细解释了网络配置中up和post-up命令的作用,以及if-up.d目录下脚本的运行机制。它指出,post-up与upup类似,用于在接口启动后执行命令。如果命令失败,ifup不会标记接口为已配置,而是打印错误信息并以0状态退出。此外,介绍了if-up.d目录下的脚本如何按名字的字典顺序通过run-parts执行。
摘要由CSDN通过智能技术生成

是的,通常会运行任何标记为可执行文件并放在该文件夹中的脚本.由于使用了运行部件,因此文件仅限于一组特定的名称.

post-up与up up相同.将脚本放在if-up.d中就像使用指向其他地方的脚本或命令的post-up一样.通常,当您只需要为单个界面运行单个命令时,您将使用up | post-up.当你有更复杂的东西时,你会创建一个脚本.

男人接口

...

up command

post-up command

Run command after bringing the interface up. If this command

fails then ifup aborts,refraining from marking the interface as

configured (even though it has really been configured),prints

an error message,and exits with status 0. This behavior may

change in the future.

...

There exists for each of the above mentioned options a directory

/etc/network/if-.d/ the scripts in which are run (with no argu-

ments) using run-parts(8) after the option itself has been processed.

男子跑步部位

run-parts runs all the executable files named within constraints

described below,If the --lsbsysinit option is not given then the names must consist

entirely of upper and lower case letters,digits,underscores,and

hyphens.

...

Files are run in the lexical sort order of their names unless the

--reverse option is given,in which case they are run in the opposite

order.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值