Turning off a scheduler from Server Connect

Looking for a Wappler solution before i submit a feature request, basically looking at something like manipulating the Server Connect "Enable Scheduler" option programmatically.

The Problem

I have a batch job i want to leave running while on holiday (23 days) , running by means of a server connect schedule.
I am using Opencage to geolocate about 35K addresses.
Opencage limits the free tier to 2.5k calls per day
Hence i intend to leave a scheduled task running every 45 seconds (approx 17 days to competion).
The task makes a database query to a file containing addresses and gets an address that has no lat/lng coordinates, calls Opencage (custom extension, will publish after testing) and saves the response.
That's pretty simple

However, in an ideal world (and probably for me, the fun of a technical challenge) i would like to scheduler to stop when all records are geocoded, can this be done within Wappler, is there a scheduler deactivate function/ methodology.

Currently i have put a workaround in place (untested) by setting an ENV variable GEOCODE_ACTIVE with value 1
In the scheduler i check that value and if not 1, the scheduler does nothing otherwise it proceeds.
If no record found i use this extension to manipulate the value of the ENV setting to 0
https://www.npmjs.com/package/@hyperbytes/wappler-get-or-set-environment-value

Which wont stop the scheduler running but at least reduces the server load to a minimum.
Anyone any better solutions. (No untested AI suggestions please, been down a few rabbit holes with that method.)

This is an accepted practice solution, but you should know a NodeJS restart is needed when updating ENV variables. Wappler recently added an ENV variable to control scheduler (and a bunch of other stuff), but it wasn't advertised.

Perhaps, it would be best to perform a Database Query to obtain the status wether it should be active or not... Maybe with date comparison (last_run_at)

That's is the type of thing i am looking for, any ideas what that variable name is is?

P.S. extension does it without needing restart using direct manipulation. It resets to default value on server restart but that would only result in a single call before it was turned off again.

Actually, it's missing a variable to control the scheduler, sorry. This is what I found in the NodeJS source-code:

setIfEnv(config, 'port', 'WAPPLER_SERVER_PORT', Number);
setIfEnv(config, 'debug', 'WAPPLER_SERVER_DEBUG');
setIfEnv(config, 'debugOutputAll', 'WAPPLER_SERVER_DEBUG_OUTPUT_ALL', val => !!val);
setIfEnv(config, 'secret', 'WAPPLER_SERVER_SECRET');
setIfEnv(config, 'redis', 'WAPPLER_SERVER_REDIS_URL', val => val === 'true' ? true : val);
setIfEnv(config.https, 'enabled', 'WAPPLER_SERVER_HTTPS', val => val === 'true');
setIfEnv(config.https.options, 'key', 'WAPPLER_SERVER_HTTPS_KEY');
setIfEnv(config.https.options, 'cert', 'WAPPLER_SERVER_HTTPS_CERT');
setIfEnv(config.https.options, 'ca', 'WAPPLER_SERVER_HTTPS_CA');
setIfEnv(config.session.store, '$type', 'WAPPLER_SERVER_SESSION_STORE_TYPE');
setIfEnv(config.session.store, 'ttl', 'WAPPLER_SERVER_SESSION_TTL', Number);
setIfEnv(config.cors, 'origin', 'WAPPLER_SERVER_CORS_ORIGIN');
setIfEnv(config.cors, 'methods', 'WAPPLER_SERVER_CORS_METHODS');
setIfEnv(config.cors, 'credentials', 'WAPPLER_SERVER_CORS_CREDENTIALS', val => val === 'true');
setIfEnv(config.csrf, 'enabled', 'WAPPLER_SERVER_CSRF', val => val === 'true');
setIfEnv(config.csrf, 'exclude', 'WAPPLER_SERVER_CSRF_EXCLUDE');
setIfEnv(config.rateLimit, 'enabled', 'WAPPLER_SERVER_RATELIMIT', val => val === 'true');
setIfEnv(config.rateLimit, 'duration', 'WAPPLER_SERVER_RATELIMIT_DURATION', Number);
setIfEnv(config.rateLimit, 'points', 'WAPPLER_SERVER_RATELIMIT_POINTS', Number);
setIfEnv(config.rateLimit.private, 'provider', 'WAPPLER_SERVER_RATELIMIT_PRIVATE_PROVIDER');
setIfEnv(config.rateLimit.private, 'duration', 'WAPPLER_SERVER_RATELIMIT_PRIVATE_DURATION', Number);
setIfEnv(config.rateLimit.private, 'points', 'WAPPLER_SERVER_RATELIMIT_PRIVATE_POINTS', Number);
setIfEnv(config, 'cluster', 'WAPPLER_SERVER_CLUSTER', val => val === 'true');

But even if such were implemented, it wouldn't play nice with your proposed solution, because the check wether cron should be enabled is done on start-up only. So, your current solution is the best

I have just checked, other than discovering the extension does not play nicely with numeric values ( needs a fix), now using Y/N) changing value via the ENV extension to "N" from "Y" does result in the scheduler action terminating immediately when called but i would still prefer a method of actually turning it off.