| 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 | include_once('rrd-config.inc.php'); |
| 12 | |
| 13 | if (php_sapi_name() == 'cli') { |
| 14 | // automated updates |
| 15 | $rrd = new rrdstat($rrd_info, 'video.temp'); |
| 16 | $rrd->update(); |
| 17 | } |
| 18 | else { |
| 19 | print('this is a commandline app.'); |
| 20 | } |
| 21 | ?> |