Skip to content

Instantly share code, notes, and snippets.

@viegelinsch
Created July 13, 2015 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viegelinsch/c21fd3832bfc2cf9802e to your computer and use it in GitHub Desktop.
Save viegelinsch/c21fd3832bfc2cf9802e to your computer and use it in GitHub Desktop.
Add current IP to /etc/issue (aka linux login greeting)
#!/bin/sh
# file: /etc/network/if-up.d/add-ip-to-etc-issue
# source: "stolen" somewhere
if [ "$METHOD" = loopback ]; then
exit 0
fi
# Only run from ifup.
if [ "$MODE" != start ]; then
exit 0
fi
cp /etc/issue.orig /etc/issue
/sbin/ifconfig eth1 | grep "inet addr" | awk '{ print $2 }' | awk -F: '{ print "Current IP: " $2 }' >> /etc/issue
echo "" >> /etc/issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment