i don't have system console access for few environments . i want to check runModes please help me. how to check?
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @gmahendra ,
The slingSettingsService service is deprecated. It's never recommended you use a deprecated code. You can check this: https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2476
Since it was very necessary in some situations we can write a custom simple code for this.
In your OSGI config file create something like this.
Maybe you already have some. You can check how you read it from OSGI config: https://medium.com/@toimrank/aem-r6-annotation-57514f7e9838
For this, in your config file just add an extra field
system.runmode=author/publish
system.instance=prod/stage
And finally, in your Java class Inject your service and get the run mode by calling the function.
Hope you understand this custom solution and why I recommended you for this custom one.
hello @gmahendra
If you possibly have access to the server via terminal, please try executing "ps -ef|grep java"
Look for runmode info in output.
Hi,
You can get the runmodes in sightly by a sling model
@PostConstruct
public void init() {
String runModes = slingSettingsService.getRunModes().toString();
}
or check below link
https://gist.github.com/gabrielwalt/278f8cee870aac7ec619
Hope this helps!
Hello @gmahendra -
>> If you are using AEM as a cloud service, here are two approaches which you can opt to identify the run modes for a given environment :
1. Adobe Admin Console: Access the Adobe Admin Console (https://[environment-name].adobeioruntime.net/admin), which provides a web-based interface to manage your AEMaaCS instances. Within the Admin Console, navigate to the "Properties" section of your AEM environment. There, you should be able to find the active run modes listed.
2. The Programmatic way : [both AEM as cloud service & on-premise]
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.apache.sling.settings.SlingSettingsService;
@Component(service = MyComponent.class)
public class MyComponent {
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.STATIC)
private SlingSettingsService slingSettingsService;
public void activate() {
String[] runModes = slingSettingsService.getRunModes();
// Process the run modes
}
}
Hello @gmahendra ,
The slingSettingsService service is deprecated. It's never recommended you use a deprecated code. You can check this: https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2476
Since it was very necessary in some situations we can write a custom simple code for this.
In your OSGI config file create something like this.
Maybe you already have some. You can check how you read it from OSGI config: https://medium.com/@toimrank/aem-r6-annotation-57514f7e9838
For this, in your config file just add an extra field
system.runmode=author/publish
system.instance=prod/stage
And finally, in your Java class Inject your service and get the run mode by calling the function.
Hope you understand this custom solution and why I recommended you for this custom one.
Views
Likes
Replies
Views
Likes
Replies