Last active
October 27, 2015 06:18
-
-
Save nczz/69bcabbcbad7874d4e01 to your computer and use it in GitHub Desktop.
Update dynamic IP to server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip=`ip -4 route get 1 | head -1 | cut -d' ' -f8 | tr -d '\n'` | |
now=`date` | |
printf -v data '{"IP":"%s","UpdatedAt":"%s"}' $ip "$now" | |
curl -X PATCH -d "$data" 'http://path.to/server/log' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment