add Safari for Windows, better Safari detection, more consistency for Symbian
[php-utility-classes.git] / testbed / rrd / rrd-update.php
CommitLineData
4a778b7e 1<?php
2$myfile = $_SERVER['SCRIPT_FILENAME'];
3while (is_link($myfile)) { $myfile = readlink($myfile); }
4if (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
10include_once('rrdstat.php-class');
4d8d65db
RK
11
12$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
13if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
14include_once($rrd_config_file);
4a778b7e 15
16if (php_sapi_name() == 'cli') {
17 // automated updates
18 $autoupdate = array();
19 foreach ($rrd_info as $iname=>$rinfo) {
20 if (isset($rinfo['auto-update']) && $rinfo['auto-update']) {
21 $autoupdate[] = $iname;
22 }
23 }
24 $autoupdate[] = 'rrdup';
25 foreach ($autoupdate as $rrdname) {
26 $rrd = new rrdstat($rrd_info, $rrdname);
27 $rrd->update();
28 }
29}
30else {
31 print('this is a commandline app.');
32}
33?>