|
-
Jul 6th, 2005, 04:01 AM
#1
Perl variables ....
Seems like it only takes the first vhost . It would help if I knew what all these variables in perl meant. 
Code:
<perl>
#!/usr/bin/perl -w
#line <1022>
local ($vhost_dir, $doc_root, $name, $vh);
$vhost_dir = "/home/web";
opendir(VHOSTS, $vhost_dir);
my @file_list = grep(/^[^\.]/,readdir(VHOSTS));
closedir(VHOSTS);
foreach $name (@file_list) {
$doc_root = "$vhost_dir/$name";
if (-d $doc_root) {
$vh={
ServerName => "$name.codedv.com",
DocumentRoot => "$doc_root/htdocs",
SuExecUserGroup => "$name users",
CustomLog => "$doc_root/logs/access_log common",
ErrorLog => "$doc_root/logs/error_log",
ScriptAlias => "/cgi-bin/ $doc_root/cgi-bin/",
Directory => {
"$doc_root/cgi-bin" => {
Options => "+ExecCGI",
Order => "allow,deny",
Allow => "from all"
}
}
};
if (-f "$doc_root/conf/httpd.conf") {
$$vh{Include} = "$doc_root/conf/httpd.conf";
}
$VirtualHost{'10.10.3.2:80'};
}
}
__END__
</perl>
Last edited by visualAd; Jul 6th, 2005 at 04:09 AM.
-
Jul 6th, 2005, 04:03 AM
#2
Re: Perl ...... yuk ...... :sick:
I think I get it now anyway but still no luck ... it seems the its an array and I need to push it on :thinks:
-
Jul 6th, 2005, 04:04 AM
#3
Re: Perl ...... yuk ...... :sick:
Stupid thing - grrrrrrrrr
Code:
<perl>
#!/usr/bin/perl -w
#line <1022>
local ($vhost_dir, $doc_root, $name, $vh);
$vhost_dir = "/home/web";
opendir(VHOSTS, $vhost_dir);
my @file_list = grep(/^[^\.]/,readdir(VHOSTS));
closedir(VHOSTS);
foreach $name (@file_list) {
$doc_root = "$vhost_dir/$name";
if (-d $doc_root) {
$vh={
ServerName => "$name.codedv.com",
DocumentRoot => "$doc_root/htdocs",
SuExecUserGroup => "$name users",
CustomLog => "$doc_root/logs/access_log common",
ErrorLog => "$doc_root/logs/error_log",
ScriptAlias => "/cgi-bin/ $doc_root/cgi-bin/",
Directory => {
"$doc_root/cgi-bin" => {
Options => "+ExecCGI",
Order => "allow,deny",
Allow => "from all"
}
}
}
if (-f "$doc_root/conf/httpd.conf") {
$$vh{Include} = "$doc_root/conf/httpd.conf";
}
push @{ $VirtualHost{'10.10.3.2:80'} }, $vh
}
}
__END__
</perl>
-
Jul 6th, 2005, 04:06 AM
#4
Re: Perl ...... yuk ...... :sick:
Gottit YAYYYYYYY 
Code:
<perl>
#!/usr/bin/perl -w
#line <1022>
local ($vhost_dir, $doc_root, $name, $vh);
$vhost_dir = "/home/web";
opendir(VHOSTS, $vhost_dir);
my @file_list = grep(/^[^\.]/,readdir(VHOSTS));
closedir(VHOSTS);
foreach $name (@file_list) {
$doc_root = "$vhost_dir/$name";
if (-d $doc_root) {
$vh={
ServerName => "$name.codedv.com",
DocumentRoot => "$doc_root/htdocs",
SuExecUserGroup => "$name users",
CustomLog => "$doc_root/logs/access_log common",
ErrorLog => "$doc_root/logs/error_log",
ScriptAlias => "/cgi-bin/ $doc_root/cgi-bin/",
Directory => {
"$doc_root/cgi-bin" => {
Options => "+ExecCGI",
Order => "allow,deny",
Allow => "from all"
}
}
};
if (-f "$doc_root/conf/httpd.conf") {
$$vh{Include} = "$doc_root/conf/httpd.conf";
}
push @{ $VirtualHost{'10.10.3.2:80'} }, $vh
}
}
__END__
</perl>
-
Jul 6th, 2005, 04:06 AM
#5
Re: Perl ...... yuk ...... :sick:
I still havn't got a clue how the variables work but the main thing is it works
-
Jul 6th, 2005, 04:07 AM
#6
Re: Perl ...... yuk ...... :sick:
Still wrong forum though..
-
Jul 6th, 2005, 04:08 AM
#7
Re: Perl ...... yuk ...... :sick:
You were too slow - I solved my problem now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|