"ntop.sh", "start" => $start, "stop" => "/usr/bin/killall ntop")); /* Set up admin password and (re)start services if not booting */ if ((function_exists("platform_booting")) && (!platform_booting())) { ntop_stop_service(); ntop_set_password(); start_service("ntop"); } elseif (!($g['booting'])) { ntop_stop_service(); ntop_set_password(); start_service("ntop"); } conf_mount_ro(); } function ntop_stop_service() { if (is_service_running("ntop")) { stop_service("ntop"); // Wait for ntop to shut down cleanly. for ($i = 0; $i <= 10; $i++) { if (!is_process_running("ntop")) { break; } sleep(2); } } } function ntop_set_password() { global $config; if (is_array($config['installedpackages']['ntop'])) { $ntop_config = $config['installedpackages']['ntop']['config'][0]; } else { $ntop_config = array(); } $ntop_password = $ntop_config['password'] ?: "admin"; unlink_if_exists("/var/db/ntop/ntop_pw.db"); mwexec("/usr/local/bin/ntop --set-admin-password={$ntop_password}"); sleep(2); } function ntop_validate_input($post, &$input_errors) { if (empty($post['password']) || empty($post['passwordagain'])) { $input_errors[] = "You must provide (and confirm) ntop's password."; } if ($post['password'] != $post['passwordagain']) { $input_errors[] = "The provided passwords did not match."; } } ?>