[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Apache + perl + cronolog
From:       "Tue Topholm" <tt () device ! dk>
Date:       2006-10-31 13:37:21
Message-ID: 20061031133705.0FAD69398D9 () smtp ! webpartner ! dk
[Download RAW message or body]

I have this script:

<Perl>
use DBI;
my ($sth, $dbh, $domain, $domainID, $created, $sql);
$dbh = DBI->connect("DBI:mysql:ccc:cccc","ccc","ccc");
$sth = $dbh->prepare("SELECT domainID, domain, created FROM domain ORDER BY
domainID ASC");
$sth->execute();
while (($domainID, $domain, $created) = $sth->fetchrow_array())
{
if($created == 0)
{
system("/bin/mkdir /home/$domain");
system("/bin/mkdir /home/$domain/www");
system("/bin/mkdir /home/$domain/ErrorLog");
system("/bin/chown apache:apache -R /home/$domain");
$sql = $dbh->prepare("UPDATE domain SET created = 1 WHERE domainID =
$domainID");
$sql->execute();
}
push @{ $VirtualHost{'*:80'} },
{
ServerName => "$domain",
ServerAdmin => " <mailto:postmaster@$domain%22> postmaster@$domain";,
ServerAlias => "www.$domain",
DocumentRoot => "/home/$domain/www",
ErrorLog => "/home/$domain/ErrorLog/$domain-error_log",
CustomLog => "|/usr/sbin/cronolog /home/log/$domain-access_log.%Y-%m-%d
combined",
};
}
$sth->finish();
$dbh->disconnect();
</Perl>

 

 

But it crashes when it tries to read the line:

CustomLog => "|/usr/sbin/cronolog /home/log/$domain-access_log.%Y-%m-%d
combined",

 

The failure is:
apachectl: Configuration syntax error, will not run "graceful":
Syntax error on line 2 of /vhosts/vhosts.conf:
$parms->add_config() has failed: error in condition clause at
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-
thread-multi/Apache2/PerlSections.pm line 203.\n



If a remove this line, everything works just perfect.

 

Who should I define cronolog??







 

Med venlig hilsen / Best Regards
Tue Topholm

Device.Webbureau
M: +45 26 74 07 41

P: +45 70 21 00 04
LinkedIN:  <http://www.linkedin.com/in/ttopholm>
http://www.linkedin.com/in/ttopholm

 


[Attachment #3 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=DA link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>I have this script:<br>
<br>
</span></font><font size=1 face=Arial><span lang=EN-GB style='font-size:9.0pt;
font-family:Arial'>&lt;Perl&gt;<br>
use DBI;<br>
my ($sth, $dbh, $domain, $domainID, $created, $sql);<br>
$dbh =
DBI-&gt;connect(&quot;DBI:mysql:ccc:cccc&quot;,&quot;ccc&quot;,&quot;ccc&quot;);<br>
$sth = $dbh-&gt;prepare(&quot;SELECT domainID, domain, created FROM domain
ORDER BY domainID ASC&quot;);<br>
$sth-&gt;execute();<br>
while (($domainID, $domain, $created) = $sth-&gt;fetchrow_array())<br>
{<br>
if($created == 0)<br>
{<br>
system(&quot;/bin/mkdir /home/$domain&quot;);<br>
system(&quot;/bin/mkdir /home/$domain/www&quot;);<br>
system(&quot;/bin/mkdir /home/$domain/ErrorLog&quot;);<br>
system(&quot;/bin/chown apache:apache -R /home/$domain&quot;);<br>
$sql = $dbh-&gt;prepare(&quot;UPDATE domain SET created = 1 WHERE domainID =
$domainID&quot;);<br>
$sql-&gt;execute();<br>
}<br>
push @{ $VirtualHost{'*:80'} },<br>
{<br>
ServerName =&gt; &quot;$domain&quot;,<br>
ServerAdmin =&gt; &quot;</span></font><font size=1 face=Arial><span
style='font-size:9.0pt;font-family:Arial'><a href="mailto:postmaster@$domain%22"
target="_new"><span lang=EN-GB>postmaster@$domain&quot;</span></a></span></font><font
size=1 face=Arial><span lang=EN-GB style='font-size:9.0pt;font-family:Arial'>;,<br>
ServerAlias =&gt; &quot;www.$domain&quot;,<br>
DocumentRoot =&gt; &quot;/home/$domain/www&quot;,<br>
ErrorLog =&gt; &quot;/home/$domain/ErrorLog/$domain-error_log&quot;,<br>
CustomLog =&gt; &quot;|/usr/sbin/cronolog /home/log/$domain-access_log.%Y-%m-%d
combined&quot;,<br>
};<br>
}<br>
$sth-&gt;finish();<br>
$dbh-&gt;disconnect();<br>
&lt;/Perl&gt;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'>But it crashes when it tries to read the line:<br>
<br>
CustomLog =&gt; &quot;|/usr/sbin/cronolog /home/log/$domain-access_log.%Y-%m-%d
combined&quot;,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'>The failure is:<br>
apachectl: Configuration syntax error, will not run &quot;graceful&quot;:<br>
Syntax error on line 2 of /vhosts/vhosts.conf:<br>
$parms-&gt;add_config() has failed: error in condition clause at
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-
thread-multi/Apache2/PerlSections.pm line 203.\n<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'><br>
<br>
If a remove this line, everything works just perfect.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-GB style='font-size:
9.0pt;font-family:Arial'>Who should I define cronolog??<br>
<br>
<br>
<br>
<br>
<br>
</span></font><font size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Med venlig hilsen / Best Regards<br>
Tue Topholm</span></font><span lang=EN-GB><o:p></o:p></span></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Device.Webbureau<br>
M: +45 26 74 07 41</span></font><span lang=EN-GB><o:p></o:p></span></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>P: +45 70 21 00 04<br>
LinkedIN: </span></font><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><a href="http://www.linkedin.com/in/ttopholm"><span
lang=EN-GB>http://www.linkedin.com/in/ttopholm</span></a></span></font><span
lang=EN-GB><o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic