fn_autoip 391 B

12345678910111213141516171819
  1. #!/bin/bash
  2. # LGSM fn_autoip function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 010115
  6. # Description: Identifies the server interface IP.
  7. # If multiple interfaces this will need to be set manually.
  8. if [ ! -f /bin/ip ]; then
  9. ipcommand="/sbin/ip"
  10. else
  11. ipcommand="ip"
  12. fi
  13. getip=$(hostname -I)
  14. if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
  15. ip=${getip}
  16. fi