Universal way of detecting internal ip
This commit is contained in:
parent
6112e7e69b
commit
cf7d4f8050
2 changed files with 9 additions and 3 deletions
|
@ -24,8 +24,8 @@ LSB="$(lsb_release -is)"
|
||||||
systemctl start docker.service
|
systemctl start docker.service
|
||||||
systemctl enable docker.service
|
systemctl enable docker.service
|
||||||
|
|
||||||
# If we are on Arch
|
|
||||||
# if [[ "${LSB}" == "Arch" ]]; then
|
# if [[ "${LSB}" == "Arch" ]]; then
|
||||||
|
# sudo "${ROOT_FOLDER}"/scripts/pacapt -S hostname -y
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# Create configured status
|
# Create configured status
|
||||||
|
|
|
@ -55,7 +55,10 @@ fi
|
||||||
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
|
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
|
||||||
STATE_FOLDER="${ROOT_FOLDER}/state"
|
STATE_FOLDER="${ROOT_FOLDER}/state"
|
||||||
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
|
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
|
||||||
INTERNAL_IP="$(hostname -I | awk '{print $1}')"
|
|
||||||
|
NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}')"
|
||||||
|
INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)"
|
||||||
|
# INTERNAL_IP="$(hostname -I | awk '{print $1}')"
|
||||||
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
||||||
ARCHITECTURE="$(uname -m)"
|
ARCHITECTURE="$(uname -m)"
|
||||||
|
|
||||||
|
@ -159,7 +162,10 @@ echo "Running system-info.sh..."
|
||||||
bash "${ROOT_FOLDER}/scripts/system-info.sh"
|
bash "${ROOT_FOLDER}/scripts/system-info.sh"
|
||||||
|
|
||||||
# Add crontab to run system-info.sh every minute
|
# Add crontab to run system-info.sh every minute
|
||||||
! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && (crontab -l; echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh") | crontab -
|
! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && (
|
||||||
|
crontab -l
|
||||||
|
echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh"
|
||||||
|
) | crontab -
|
||||||
|
|
||||||
## Don't run if config-only
|
## Don't run if config-only
|
||||||
if [[ ! $ci == "true" ]]; then
|
if [[ ! $ci == "true" ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue