For When You Can't Have The Real Thing
[ start | index | login ]
start > Fedora > 34 > Add IP Information To issue File

Add IP Information To issue File

Created by dave. Last edited by dave, 2 years and 329 days ago. Viewed 858 times. #2
[diff] [history] [edit] [rdf]

Add IP information to /etc/issue


IP=${1:-`hostname -I`}
# Add "IP ADDRESS" line if not already found
grep "IP ADDRESS" /etc/issue > /dev/null
if [ "$?" -ne "0" ]; then
  echo >> /etc/issue
  echo "IP ADDRESS" >> /etc/issue
sed -i s/"IP ADDRESS.*"/"IP ADDRESS : $IP"/g /etc/issue

systemd service file:

Description=Add IP address to /etc/issue

[Service] Type=oneshot ExecStart=/usr/local/sbin/update-issue-with-ip RemainAfterExit=true ExecStop=/usr/local/sbin/update-issue-with-ip UNKNOWN


Do your daemon-reload and enable --now and you should be good to go.


>>Steve Parker


My changes from the source:

  • I renamed the script from the example as /usr/local/sbin/update-issue-with-ip
  • the script is in /usr/local/sbin instead of /usr/bin
  • my .service file lives in /etc/systemd/system
This is probably my old-school unix history showing more than anything else. Strictly speaking since this isn't a user-interactive script, the script should probably live in /usr/local/libexec somewhere.
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt