Last active
May 2, 2018 16:57
-
-
Save shi-yan/5e198ecf10b15de8e95fe8be7a0f4ffc to your computer and use it in GitHub Desktop.
Revisions
-
shi-yan renamed this gist
May 2, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shi-yan created this gist
Oct 5, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash touch oldIp.txt md1=$(cat "oldIp.txt"); md2=$(hostname -I); if [ "$md1" = "$md2" ]; then echo The same else echo Different hostname -I cat oldIp.txt hostname=$(hostname); echo "{\"text\":\"ip of ${hostname} is ${md2}\"}" | curl -X POST -H 'Content-type: application/json' --data @- https://hooks.slack.com/services/xxx/xxx/xxx hostname -I > oldIp.txt fi