14

I have done the following shell script that update the /etc/issue with the current ip's of all non-loopback interfaces:

#!/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

Now I want to make it run at boot in order to update the /etc/issue with the network ips. Over Debian-based distros I would place it over /etc/rc.local but alpine does not have this file. How I will make this script to run in an equivalent way of /etc/rc.local?

Edit 1

I tried to put it on /etc/local.d but it failed to change properly the /etc/issue

1 Answer 1

15

You have to enable local.d scripts at boot time:

rc-update add local default

Then just place your script into /etc/local.d/UpdateIssue.start and make it executable.

You can find more details about local.d scripts in OpenRC on Gentoo wiki:

https://wiki.gentoo.org/wiki//etc/local.d

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .