4cd77052f010ad59f9be0c54febcf1cf7681508c
[php-utility-classes.git] / testbed / rrd / rrd-test.php
1 <?php
2 $myfile = $_SERVER['SCRIPT_FILENAME'];
3 while (is_link($myfile)) { $myfile = readlink($myfile); }
4 if (getcwd() != dirname($myfile)) {
5   // change to directory of the script if called from different directory
6   $orig_workingdir = getcwd();
7   chdir(dirname($myfile));
8 }
9
10 include_once('rrdstat.php-class');
11
12 $rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
13 if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
14 include_once($rrd_config_file);
15
16 if (php_sapi_name() == 'cli') {
17   // automated updates
18   $rrd = new rrdstat($rrd_info, 'video.temp');
19   $rrd->update();
20 }
21 else {
22   print('this is a commandline app.');
23 }
24 ?>