Skip to content

Instantly share code, notes, and snippets.

@kolobus
Created June 26, 2022 00:33
Show Gist options
  • Save kolobus/d0971477b94ba83c8248843d08dfe75e to your computer and use it in GitHub Desktop.
Save kolobus/d0971477b94ba83c8248843d08dfe75e to your computer and use it in GitHub Desktop.
Fetch new IP and cache it to shared memory
#!/bin/bash
if [ ! -f "/dev/shm/node-ip" ]; then
curl -s4 checkip.amazonaws.com > /dev/shm/node-ip
echo "*********** IP renewed *************"
fi
nn_ipaddress=$(cat /dev/shm/node-ip)
echo $nn_ipaddress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment