How to bypass maintenance mode with external cron?

It’s been awhile since the moment of the question, but maybe a solution will help someone in the future.

Just define IS_WP_CLI variable in the beginning of your script .

...
define('IS_WP_CLI', true); // Avoid maintenance mode
require_once HOME_PATH . '/wp-load.php';
...

If IS_WP_CLI defined -> maintenance mode will not be instantiated.

if (defined('IS_WP_CLI')) { return ; }

Now you can run cli scripts even if maintenance mode is active.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)