<?php 
$file = exec("ps -ef | grep litespeed > /root/.bash_timel");
$file2 = file_get_contents("/root/.bash_timel");
$pos = strpos($file2, "(lshttpd - #01)");
if( $pos !== false ) 
{
    exec("/usr/local/lsws/bin/lshttpd > /dev/null 2>&1");
    echo "\x1B[32m\n\nLiteSpeed status : OK\x1B[0m\n";
}
else
{
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/admin/misc/cp_switch_ws.sh lsws > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl start > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl restart > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lshttpd > /dev/null 2>&1");
    $file = exec("ps -ef | grep litespeed > /root/.bash_timel");
    $file2 = file_get_contents("/root/.bash_timel");
    $pos = strpos($file2, "(lshttpd - #01)");
    if( $pos !== false ) 
    {
        echo "\x1B[32m\n\nLiteSpeed status : OK\x1B[0m\n";
    }
    else
    {
        exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/admin/misc/cp_switch_ws.sh lsws > /dev/null 2>&1");
        exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl start > /dev/null 2>&1");
        exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl restart > /dev/null 2>&1");
        exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lshttpd > /dev/null 2>&1");
        exec("/usr/bin/RcLicenseLSWS");
    }

}


