// store the pid
     $fp = fopen(PIDFILE, "w+");
     fwrite($fp, $pid . "\n" . time());
     fclose($fp);
     while (file_exists(PIDFILE)) {
         usleep(50000);
     }
 } else {
     //$checker = new ProxyCheckerImpl();
     $checker = new ParanoidProxyCheckerImpl();
     $framework = new ProxyFramework("framework.db", $checker, 7200, 5400, 1, 30, 20, PIDFILE);
     $atom = new AtomintersoftModule();
     $samair = new SamairModule();
     $freechecker = new FreeCheckerModule();
     $nntime = new NNTimeModule();
     $framework->addModule($atom);
     // since samair.ru is down most of the time, perform this check before adding the samair module to PF
     print "Checking Samair\n";
     fw('samair.ru', 80, '-A');
     $test = shell_exec('curl -f samair.ru -m 20 --connect-timeout 20');
     //fw('samair.ru', 80, '-D');
     if (trim($test) != '' && strpos($test, "connect() timed out") === false) {
         $framework->addModule($samair);
     }
     $framework->addModule($freechecker);
     print "Checking NNTime\n";
     fw('nntime.com', 80, '-A');
     $test = shell_exec('curl -f nntime.com -m 20 --connect-timeout 20');
     //fw('nntime.com', 80, '-D');
     if (trim($test) != '' && strpos($test, "connect() timed out") === false) {
         $framework->addModule($nntime);