Python Forum

Full Version: want same code in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
date_default_timezone_set('UTC');
while(1){
    $seconds=date('s');
    if($seconds ==' 00'){
        while(1){
            echo date("d/M/Y:H:i:s")." Current Time\n";
            $seconds=date('s');
            $first_digit_of_second=substr($seconds, 0, 1);
            $past_second=$first_digit_of_second -1;
            if(($past_second >= 0) and ($past_second <= 5)) {
                $mod_date=date("d/M/Y:H:i");
                $mod_datetime="$mod_date:$past_second";
                $OUT=exec("/usr/bin/tail -n1000 /var/log/httpd/ssl_access_log | grep $mod_datetime | wc -l");
                echo "Current Users on xxx.com\n".$OUT;
                echo "\n";
            }
            else:
                echo "Check SSL_access_log file for details\n";
            sleep(10);
        }
    }
    sleep(1);
}
Just posting some php code won't work.
Explain what your goal is, post your python code (in python tags). Ask specific questions. If you get any error - post full traceback in error tags.

If you just looking for someone to write code for you - this should be in JOBS section (check what to include in posts in JOBS section). Let me know if you want to move this thread in JOBS section of the forum.