host file
<3
:1

Date posted: Jan. 5, 2024, 2:38 p.m.
Problem: need host file
What does it do?: Generates a host file entry for all domains on the server
Problem: need host file
What does it do?: Generates a host file entry for all domains on the server
sean@castle-murray.com[~/bash/awk/cpanel] #
awk -F ": " -v host=$(hostname -i) '!/*/ {print host " " $1 " www." $1 }' /etc/userdomains
sean@castle-murray.com[~/bash/awk/cpanel] #
sean@castle-murray.com[~/bash/awk/cpanel] #
This will generate a file with some extra stuff in it. subdomains don't usually have a www. subdomain. But it does work.
sean@castle-murray.com[~/bash/awk/cpanel] #
This also doesn't cover dedicated IP's. It's a quick and dirty.