Skip to content

Instantly share code, notes, and snippets.

@xkou
Last active January 4, 2016 15:59
Show Gist options
  • Save xkou/8644127 to your computer and use it in GitHub Desktop.
Save xkou/8644127 to your computer and use it in GitHub Desktop.
show ip before login for ubuntu
#!/bin/sh
if [ "$METHOD" = loopback ]; then
exit 0
fi
# Only run from ifup.
if [ "$MODE" != start ]; then
exit 0
fi
IP=`/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }'`
cp /etc/issue-standard /etc/issue
echo "$IP" >> /etc/issue
echo "" >> /etc/issue
# abouve to /etc/network/if-up.d/show-ip-address +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment