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?
albudarov
(Alexander Budarov)
December 2, 2022, 9:07am
#2
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
albudarov
(Alexander Budarov)
December 2, 2022, 4:31pm
#4
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());