current testbed version as of may 2007
[php-utility-classes.git] / testbed / rrd / rrd-test.php
diff --git a/testbed/rrd/rrd-test.php b/testbed/rrd/rrd-test.php
new file mode 100644 (file)
index 0000000..9b2ee51
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+$myfile = $_SERVER['SCRIPT_FILENAME'];
+while (is_link($myfile)) { $myfile = readlink($myfile); }
+if (getcwd() != dirname($myfile)) {
+  // change to directory of the script if called from different directory
+  $orig_workingdir = getcwd();
+  chdir(dirname($myfile));
+}
+
+include_once('rrdstat.php-class');
+include_once('rrd-config.inc.php');
+
+if (php_sapi_name() == 'cli') {
+  // automated updates
+  $rrd = new rrdstat($rrd_info, 'video.temp');
+  $rrd->update();
+}
+else {
+  print('this is a commandline app.');
+}
+?>