How to easily execute a one-time maintenance script on Elgg 2.3 and newer because old way does no longer work?

Sometimes you need to execute a script to do some maintenance work and you know you will only need it once. On Elgg 1.x I did it by booting the engine with

dirname(__DIR__) . "/engine/start.php";

then added my code, placed the script in the Elgg root directory and then called it from the browser.

As the docs say the code above should no longer be used. I did it with

require_once dirname(__DIR__) . "/vendor/autoload.php";

\Elgg\Application::start();

and I'm pretty sure that worked in the past.

But now on Elgg 2.3 and also on master it no longer works (I don't know with which version of Elgg 2 it stopped working exactly). Instead of executing the script Elgg tries to serve the "scriptname" page - and doesn't find it of course.

What to do now instead? Is there any other way apart from creating a full "maintenance" plugin that allows to trigger the execution of the script?