Skip to content

Instantly share code, notes, and snippets.

@chriskalmar
Last active December 17, 2019 11:19
Show Gist options
  • Save chriskalmar/bbba6e242b78fffcb3415c673e8c1b30 to your computer and use it in GitHub Desktop.
Save chriskalmar/bbba6e242b78fffcb3415c673e8c1b30 to your computer and use it in GitHub Desktop.
sync your digitalocean servers to your `/etc/hosts` file
#!/bin/bash
# install doctl and hostess before use:
# https://github.com/digitalocean/doctl
# https://github.com/cbednarski/hostess
#
# brew install doctl
# brew install hostess
PREFIX=yourdomain
sudo hostess fix
doctl compute droplet list | awk 'NR>1 {print $2" "$3}' | xargs -n2 -I {} bash -c "sudo hostess add $PREFIX.{}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment