PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Apache ServerName and ServerAlias
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Apache ServerName and ServerAlias

Réponse
 
LinkBack Outils de la discussion
Vieux 26/10/2006, 17h20   #1
Rahsaan Page
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Apache ServerName and ServerAlias

Am not sure if you can me or not, but what am trying to do is in
httpd.conf i have a bunch of ServerNames and ServerAliases. that i have
to do a dig or and nslookup against the names. so there is like of 100
names that i have to go thru and i dont want to manullay type each name
and do a nslookup or a dig against it. so so for u have a little
command that will display the ServerName and ServerAlias. so what i
would like to do is have AWK or some command ingnore the out of
ServerName and ServerAlias and any whitespace or i should say spaces
between each name and pipe that command to dig or nslookup. is the
output of my command . Can anyone Assist?

Command: cat /usr/local/apache2/conf/httpd.conf|egrep
"ServerName|ServerAlias"|more
Output:

ServerName video.nbcuni.com
ServerAlias video.nbcuni.com video-origin.nbcuni.com
video.accesshollywood.com video.nbc.com video.scifi.com
video.usanetwork.co
m video.nbc.com video.bravotv.com video-origin.accesshollywood.com
video-origin.nbc.com video-origin.scifi.com video-origin.usanetwo
rk.com video-origin.nbc.com video-origin.bravotv.com
video-origin.nbcuni.com video.brilliantbutcancelled.com
video-origin.brilliantb
utcancelled.com video.dewactionsportstour.com video.ivillage.com
video.nbc4.com video.meganshow.com video.nbc4.tv video.nbc5.com vid
eo.nbc30.com video.nbc6.net video.nbc10.com video.nbc11.com
video.NBCSanDiego.com video.nbc5i.com video.wnbc.com video.rydercup.com
video.rotoworld.com

Note: the ServerAlias line is consider ass one line, not multiple lines?

  Réponse avec citation
Vieux 26/10/2006, 21h26   #2
Radoulov, Dimitre
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Apache ServerName and ServerAlias

> Am not sure if you can me or not, but what am trying to do is in
> httpd.conf i have a bunch of ServerNames and ServerAliases. that i have
> to do a dig or and nslookup against the names. so there is like of 100
> names that i have to go thru and i dont want to manullay type each name
> and do a nslookup or a dig against it. so so for u have a little
> command that will display the ServerName and ServerAlias. so what i
> would like to do is have AWK or some command ingnore the out of
> ServerName and ServerAlias and any whitespace or i should say spaces
> between each name and pipe that command to dig or nslookup. is the
> output of my command . Can anyone Assist?
>
> Command: cat /usr/local/apache2/conf/httpd.conf|egrep
> "ServerName|ServerAlias"|more
> Output:
>
> ServerName video.nbcuni.com
> ServerAlias video.nbcuni.com video-origin.nbcuni.com
> video.accesshollywood.com video.nbc.com video.scifi.com
> video.usanetwork.co
> m video.nbc.com video.bravotv.com video-origin.accesshollywood.com
> video-origin.nbc.com video-origin.scifi.com video-origin.usanetwo
> rk.com video-origin.nbc.com video-origin.bravotv.com
> video-origin.nbcuni.com video.brilliantbutcancelled.com
> video-origin.brilliantb
> utcancelled.com video.dewactionsportstour.com video.ivillage.com
> video.nbc4.com video.meganshow.com video.nbc4.tv video.nbc5.com vid
> eo.nbc30.com video.nbc6.net video.nbc10.com video.nbc11.com
> video.NBCSanDiego.com video.nbc5i.com video.wnbc.com video.rydercup.com
> video.rotoworld.com

[...]
> Note: the ServerAlias line is consider ass one line, not multiple lines?



awk '{for (i=1;i<NF+1;i++) if ( $i!="ServerName" && $i!="ServerAlias")
print $i | "nslookup"
close("nslookup")
}' file


Regards
Dimitre



  Réponse avec citation
Vieux 26/10/2006, 22h19   #3
Radoulov, Dimitre
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Apache ServerName and ServerAlias


"Radoulov, Dimitre" <cichomitiko @ gmail com> wrote in message
news:454119f0$0$49198$14726298@news.sunsite.dk...
>> Am not sure if you can me or not, but what am trying to do is in
>> httpd.conf i have a bunch of ServerNames and ServerAliases. that i have
>> to do a dig or and nslookup against the names. so there is like of 100
>> names that i have to go thru and i dont want to manullay type each name
>> and do a nslookup or a dig against it. so so for u have a little
>> command that will display the ServerName and ServerAlias. so what i
>> would like to do is have AWK or some command ingnore the out of
>> ServerName and ServerAlias and any whitespace or i should say spaces
>> between each name and pipe that command to dig or nslookup. is the
>> output of my command . Can anyone Assist?
>>
>> Command: cat /usr/local/apache2/conf/httpd.conf|egrep
>> "ServerName|ServerAlias"|more
>> Output:
>>
>> ServerName video.nbcuni.com
>> ServerAlias video.nbcuni.com video-origin.nbcuni.com
>> video.accesshollywood.com video.nbc.com video.scifi.com
>> video.usanetwork.co
>> m video.nbc.com video.bravotv.com video-origin.accesshollywood.com
>> video-origin.nbc.com video-origin.scifi.com video-origin.usanetwo
>> rk.com video-origin.nbc.com video-origin.bravotv.com
>> video-origin.nbcuni.com video.brilliantbutcancelled.com
>> video-origin.brilliantb
>> utcancelled.com video.dewactionsportstour.com video.ivillage.com
>> video.nbc4.com video.meganshow.com video.nbc4.tv video.nbc5.com vid
>> eo.nbc30.com video.nbc6.net video.nbc10.com video.nbc11.com
>> video.NBCSanDiego.com video.nbc5i.com video.wnbc.com video.rydercup.com
>> video.rotoworld.com

> [...]
>> Note: the ServerAlias line is consider ass one line, not multiple lines?

>
>
> awk '{for (i=1;i<NF+1;i++) if ( $i!="ServerName" && $i!="ServerAlias")
> print $i | "nslookup"
> close("nslookup")
> }' file


You could use the command above on an output like this:

$cat file
ServerName video.nbcuni.com
ServerAlias video.nbcuni.com video-origin.nbcuni.com ...

If you want to run it directly on httpd.conf:

awk '/ServerName/||/ServerAlias/ {for (i=1;i<NF+1;i++) if ($i!="ServerName"
&& $i!="ServerAlias")
print $i | "nslookup"
close("nslookup")
}' httpd.conf


Regards
Dimitre







  Réponse avec citation
Vieux 27/10/2006, 17h54   #4
Rahsaan Page
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Apache ServerName and ServerAlias

Thank you, That seem to work

Radoulov, Dimitre wrote:
> "Radoulov, Dimitre" <cichomitiko @ gmail com> wrote in message
> news:454119f0$0$49198$14726298@news.sunsite.dk...
> >> Am not sure if you can me or not, but what am trying to do is in
> >> httpd.conf i have a bunch of ServerNames and ServerAliases. that i have
> >> to do a dig or and nslookup against the names. so there is like of 100
> >> names that i have to go thru and i dont want to manullay type each name
> >> and do a nslookup or a dig against it. so so for u have a little
> >> command that will display the ServerName and ServerAlias. so what i
> >> would like to do is have AWK or some command ingnore the out of
> >> ServerName and ServerAlias and any whitespace or i should say spaces
> >> between each name and pipe that command to dig or nslookup. is the
> >> output of my command . Can anyone Assist?
> >>
> >> Command: cat /usr/local/apache2/conf/httpd.conf|egrep
> >> "ServerName|ServerAlias"|more
> >> Output:
> >>
> >> ServerName video.nbcuni.com
> >> ServerAlias video.nbcuni.com video-origin.nbcuni.com
> >> video.accesshollywood.com video.nbc.com video.scifi.com
> >> video.usanetwork.co
> >> m video.nbc.com video.bravotv.com video-origin.accesshollywood.com
> >> video-origin.nbc.com video-origin.scifi.com video-origin.usanetwo
> >> rk.com video-origin.nbc.com video-origin.bravotv.com
> >> video-origin.nbcuni.com video.brilliantbutcancelled.com
> >> video-origin.brilliantb
> >> utcancelled.com video.dewactionsportstour.com video.ivillage.com
> >> video.nbc4.com video.meganshow.com video.nbc4.tv video.nbc5.com vid
> >> eo.nbc30.com video.nbc6.net video.nbc10.com video.nbc11.com
> >> video.NBCSanDiego.com video.nbc5i.com video.wnbc.com video.rydercup.com
> >> video.rotoworld.com

> > [...]
> >> Note: the ServerAlias line is consider ass one line, not multiple lines?

> >
> >
> > awk '{for (i=1;i<NF+1;i++) if ( $i!="ServerName" && $i!="ServerAlias")
> > print $i | "nslookup"
> > close("nslookup")
> > }' file

>
> You could use the command above on an output like this:
>
> $cat file
> ServerName video.nbcuni.com
> ServerAlias video.nbcuni.com video-origin.nbcuni.com ...
>
> If you want to run it directly on httpd.conf:
>
> awk '/ServerName/||/ServerAlias/ {for (i=1;i<NF+1;i++) if ($i!="ServerName"
> && $i!="ServerAlias")
> print $i | "nslookup"
> close("nslookup")
> }' httpd.conf
>
>
> Regards
> Dimitre


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h21.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13388 seconds with 12 queries