public static function run($controller, $action, $limit, $max){
        
        $current = self::get_cron($controller, $action);
        $current::execution_time();
        $current->limit = $limit;
        $current->running = 1;
        $current->success = 0;
        
        //get previous cron to set offset
        $previous = self::get_previous_cron($controller, $action);
        if (is_null($previous)){
            $current->offset = 0;
        }else{
            if (($previous->offset  + $limit) >= $max){
                $current->offset = 0;
            }else{
               $current->offset = $previous->offset + $previous->limit;
            }
        }
        
        if ($current->save()){
            Console::stdout(Console::ansiFormat("*** running ".$current->controller."/".$current->action."\n", [Console::FG_YELLOW]));
            return $current;
        }else{
            Console::stdout(Console::ansiFormat("*** failed to run ".$current->controller."/".$current->action."\n", [Console::FG_RED]));
            return false;
        }    
    }