[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Webalizer Probs



Hi All

Created a new site yesterday and added a user....and generated some
traffic on the site but got this error in my cron.daily

<error>
Error: Can't change directory to
/home/sites/www.mydomain.co.uk/users/stats/web
chown: getting attributes of
`/home/sites/www.mydomain.co.uk/users/stats/web': No such file or
directory
</error>

In webalizer.pl there is a line that should create this directory if it
does not exist. Can someone look at the file below at draw my attention
to any problems they see?

<webalizer.pl>
#!/usr/bin/perl
#
# This script runs webalizer for every virtual site on a Cobalt RaQ3 #
machine.  This depends on the configuration file /etc/webalizer.conf #
and several command-line switches including those for the LogFile and #
Hostname. # # PLEASE NOTE: The /stats directory created will be password
protected # allowing only site admins in for that site. #

# Where sites on a RaQ3/4 live
$prefix = "/home/sites";

# Status messages
my $messages;

chdir "$prefix" or die "Can't cd to $prefix??: $!\n";
opendir THEROOT, $prefix or die "Couldn't open $prefix?: $!\n";
@allsites = grep !/^\.\.?$/,  readdir THEROOT;

foreach $asite (@allsites)
{
  if (-l "$asite")
  {
    $webpath = "$prefix/$asite/users/stats";
    $thepath = "$prefix/$asite/users/stats/web";

    # Get the group id of the directory
    my $gid = (stat $webpath)[5];
    my $name = (getgrgid $gid)[0];

    # Create a directory /users/stats if it isn't there yet
    if (!-d $webpath)
    {
       mkdir $webpath, 775;
       chown 0, $gid, $webpath;
       chmod 0755, $webpath;
    }

# Create a .htaccess if it isn't there yet

    if (!-e "$thepath/.htaccess")
    {
       my $string =
"#Access file\norder allow,deny\nallow from all\nrequire group
$name\nAuthname WebStats\nAuthtype Basic\nAuthAuthoritative off\n";
       open HTACCESS, qq(>$thepath/.htaccess);
       print HTACCESS $string;
       close HTACCESS;
       chmod 0744, qq($thepath/.htaccess);
    }

    # Now just run webalizer
    $messages .=
       `/usr/local/bin/webalizer -p -n $asite -s $asite -r $asite -q -Q
-T -o $thepath $prefix/$asite/logs/web.log`;

    # Now change ownership of files for frontpage and non-frontpage
enabled sites

    if (!-d $webpath . "/_vti_bin") {
        $messages .= `echo "Frontpage NOT ENABLED on $webpath"`;
        $messages .= `chown -R httpd:$name $thepath`;
    } else {
        $messages .= `echo "Frontpage ENABLED on $webpath"`;
        $messages .= `chown -R nobody:$name $thepath`;
    }

  }
}

# Debugging printer, uncomment to use.
# These messages would be mailed to the box admin if you printed them #
and there actually were any. #print $messages;

exit 0;
</webalizer.pl>

Kind Regards
 
Paul Brown