Bash, Shell, PHP, Python, Perl, CGI
-
user72
- Posts: 6
- Joined: 2003-06-14 07:02
-
Post
by user72 »
Hi
Ich möche serverstats-0.7 einrichten , die anleitung ist verständlich nur bekomme ich eine fehlermeldung beim cron
Code: Select all
Parse error: parse error, unexpected '{' in /srv/www/htdocs/serverstats/update.php
on line 40
der Cron lautet
Code: Select all
* * * * * wwwrun /srv/www/htdocs/serverstats/update.php
es werden auch keine daten geschriben in /rrd
-
braindead
- Posts: 250
- Joined: 2002-10-22 09:49
- Location: vorm Rechner
-
Post
by braindead »
was steht denn in der /srv/www/htdocs/serverstats/update.php in Zeile 40? Gehts denn von der Kommandline aus?
-
user72
- Posts: 6
- Joined: 2003-06-14 07:02
-
Post
by user72 »
da steht nur diese { , hier mal der code , zeile 14 ist gemeint
Code: Select all
// Load all needed classes, function and everything else
require_once('init.php');
foreach ($config['sources'] as $sourcename => $sourcedata)
{
echo "Working on $sourcenamen";
$source = $sourcedata['module'];
// All needed Vars
$cachefile = CACHEPATH . $sourcename . '.sav';
$rrdcachefile = CACHEPATH . $sourcename . '.rrd.sav';
$rrdfile = RRDPATH . $sourcename . '.rrd';
// The classes may throw exceptions, so we need to catch them
try
{
if (!($source instanceof source))
{
throw new Exception('Source "' . $sourcename . '" not instanceof source');
}
$source->init();
if ($source->useCache())
{
if (file_exists($cachefile))
{
$cache = unserialize(file_get_contents($cachefile));
$source->loadCache($cache);
unset($cache);
}
else
{
$source->initCache();
}
}
$source->refreshData();
if ($source->useCache())
{
$cache = serialize($source->getCache());
file_put_contents($cachefile, $cache);
unset($cache);
}
$sourcerrd = new rrd($config['main']['rrdtool'], $rrdfile);
if (file_exists($rrdcachefile))
{
$cache = unserialize(file_get_contents($rrdcachefile));
$sourcerrd->initOptions($cache);
unset($cache);
}
else
{
if ($sourcerrd->checkVersion('<', '1.2'))
{
throw new Exception('rrdtool >= 1.2 required');
}
echo "tCreating RRD-filen";
$config['log']['logger']->logString(logger::INFO, 'Creating RRD-file for source "' . $sourcename . '"');
$source->initRRD($sourcerrd);
$sourcerrd->setStep($config['main']['step']);
if (isset($sourcedata['rra']))
{
$sourcerra = $sourcedata['rra'];
}
else
{
$sourcerra = 'default';
}
foreach ($config['rra'][$sourcerra] as $rra)
{
$sourcerrd->addArchive($rra['cf'], $rra['xff'], $rra['steps'], $rra['rows']);
}
$sourcerrd->create();
$cache = serialize($sourcerrd->getOptions());
file_put_contents($rrdcachefile, $cache);
unset($cache);
}
echo "tUpdating RRD-filen";
$config['log']['logger']->logString(logger::INFO, 'Updating source "' . $sourcename . '"');
$source->updateRRD($sourcerrd);
$sourcerrd->update();
}
catch (Exception $e)
{
echo "Error:n";
echo $e;
echo "n";
$config['log']['logger']->logException(logger::ERR, $e);
}
}
?>
-
user72
- Posts: 6
- Joined: 2003-06-14 07:02
-
Post
by user72 »
ja habe ich PHP Version 5.0.4