Disable CUBA scheduled tasks via command line

I would like to disable the scheduled tasks to be disabled via bash script on a running instance.

I’ve gone through the below links and it says that it’s possible via an environment variable

https://doc.cuba-platform.com/manual-latest/app_properties.html#setting_app_properties
https://doc.cuba-platform.com/manual-latest/app_properties_reference.html#cuba.schedulingActive

I’ve tried setting a global environment variable but the scheduled tasks keeps running

# cat /etc/environment 
CUBA_SCHEDULINGACTIVE=false

Any suggestions on what else should I do?

Hi,
It works for me.
I have changed the environment variable in the CUBA Studio’s run configuration, values true / false, and schedulers worked as expected.

Are you using CUBA 7.2?
Are you properly restarting the application server after changing environment variable? Environment is read once when the OS process starts.

Thank you Alex for your reply.

Are you using CUBA 7.2?

Yes

Are you properly restarting the application server after changing environment variable?

Yes, the cuba app is restarted using systemd

The environment variable is set properly

$ echo $CUBA_SCHEDULINGACTIVE
false

I would add a debug logging to your application, e.g. on startup.

    @Inject
    private ServerConfig serverConfig;
...

        log.info("env: " + System.getenv("CUBA_SCHEDULINGACTIVE"));
        log.info("app: " + AppContext.getProperty("cuba.schedulingActive"));
        log.info("final: " + serverConfig.getSchedulingActive());