| Server IP : 172.67.149.12 / Your IP : 104.23.243.226 Web Server : Apache System : Linux vm3310.eosdns.net 4.18.0-553.132.1.el8_10.x86_64 #1 SMP Thu Jun 11 14:27:43 UTC 2026 x86_64 User : carnalmedia ( 1000) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /mojo/ |
Upload File : |
#!/bin/bash
#
# Script: hostsgen
#
# Usage: hostsgen
#
# Description: A tool for generating the "hosts" file entries using configuration located in the "/etc/httpd/sites-enabled" directory
#
# Author: Gary Locke
#
# Changelog:
# * 10/08/2013: Gary Locke
# - Initial write
# * 10/11/2013: Gary Locke
# - Added --newip option
# - Added logic to avoid printing domains more than once
# * 02.03.2021: Nikita Shchetinin
# - Rewritten completely to be compatible with the new layout on CentOS 8
if [ "$(whoami)" != 'root' ]
then
echo "You must execute this script as the root user!"
exit 1
fi
GEN () {
for i in `ls /etc/httpd/sites-enabled`
do
head -1 /etc/httpd/sites-enabled/$i | sed 's/<VirtualHost //' | sed 's/:80>//' | tr --delete '\n'
echo -n " $i" | sed 's/.conf//'
echo " www.$i" | sed 's/.conf//'
done
}
HELP () {
echo 'A tool for generating the "hosts" file entries using configuration located in the "/etc/httpd/sites-enabled" directory'
echo "usage: hostsgen"
}
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
HELP
else
GEN
fi