我已经完成了以下shell脚本,它用所有非回送接口的当前ip更新/etc/issue
:
#!/bin/sh
echo "You can use one of the following ip addresses in order to look the page or even ssh into the machine" > /etc/issue
ip -4 -o addr show up scope global | awk '{print $2,":",$4}'| sed -e "s/\/[1-9]*//" >> /etc/issue
现在,我想让它在引导时运行,以便用网络ips更新/etc/issue
。在基于Debian的发行版上,我会把它放在/etc/rc.local
上,但是高山没有这个文件。我将如何使这个脚本以类似于/etc/rc.local
的方式运行?
我试着把它放到/etc/local.d
上,但是它没有正确地改变/etc/issue
发布于 2019-05-01 22:31:30
您必须在启动时启用local.d
脚本:
rc-update add local default
然后将脚本放入/etc/local.d/UpdateIssue.start
并使其可执行。
您可以在Gentoo wiki上的local.d
脚本中找到更多关于OpenRC脚本的详细信息:
https://unix.stackexchange.com/questions/442020
复制相似问题