3 // /etc/ntp/step-tickers generator
5 // Marc Fiuczynski <mef@cs.princeton.edu>
6 // Copyright (C) 2006 The Trustees of Princeton University
11 // Get admin API handle
12 require_once 'plc_api.php';
15 $config_directory= "/var/www/html/PlanetLabConf/ntp/";
16 $file_prefix= "ntp.conf.";
17 $default_name = "default";
18 $file_name = $config_directory . $file_prefix . $default_name;
21 $nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR']));
22 if (!empty($nodenetworks)) {
23 $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id']));
34 /* Look for config file */
36 $hostname_bits = explode('.', $hostname);
37 $chunk_counter = sizeof ($hostname_bits);
38 $compare_chunk = $hostname ;
41 /* look for the host specific overrides */
42 $file_name = $config_directory . "host/". $file_prefix . $compare_chunk ;
43 if (is_file($file_name)) {
48 /* look for the domain specific overrides */
49 while ($chunk_counter > 0) {
50 $file_name = $config_directory . $file_prefix . $compare_chunk ;
51 if (is_file($file_name)) {
56 array_shift($hostname_bits);
57 $compare_chunk = implode('.',$hostname_bits);
62 if ($found_file and is_readable($file_name)) {
63 $lines=file($file_name);
66 $file_name = $config_directory . $file_prefix . $default_name ;
67 $lines=file($file_name);
70 foreach ($lines as $line_num => $line) {
72 $elements=explode(' ',$line);
73 if ($elements[0] == "server") {
74 print ("$elements[1]\n");