In my previous post, we installed the Oracle Integration Cloud connectivity agent. In some cases, you may have both your production and non-production agent running on the same machine. This blog post will not only demonstrate how to start and stop the agent, but also how to distinguish between the two.
Two Agents – One Machine
Let’s say we have two agents installed on one machine. They are on the same mount point but in different directories. They may look similar to this table. This example is assuming a Linux operating system.
Environment | Installation Directory | Agent Group |
Production | /u01/app/oracle/oic/prod | PROD_OIC_AGENT |
Non-Production | /u01/app/oracle/oic/test | TEST_OIC_AGENT |
Start the Agent
First, login to your OIC agent server. Second, start the agent by navigating to the appropriate directory. Finally, launch it in the background.
$ cd /u01/app/oracle/oic/test
$ nohup java -jar connectivityagent.jar &
To make sure the agent is running, check the log file for any errors. If there are any issues typically the connectivity agent will quit running in the background.
/u01/app/oracle/oic/test/agenthome/logs/agent-diagnostic0.log
Stop the Agent
First, login to your OIC agent server.
Next, navigate to the directory for the environment that requires a restart, either production or non-production. Let’s use test as an example.
$ cd /u01/app/oracle/oic/test
Issue the ps command to show active processes for the connectivity agents.
$ ps -fu oracle | grep connectivityagent
oracle 8113 1 0 Aug18 ? 02:40:30 java -jar connectivityagent.jar
oracle 29363 1 0 Sep10 ? 00:40:50 java -jar connectivityagent.jar
To determine which one is the test connectivity agent, use the list of open files with the process id determined in the previous step. The directory where the agent was started will be shown.
$ lsof -p 8113 | grep cwd
java 8113 oracle cwd DIR 252,4 4096 4850870 /u01/app/oracle/oic/test
$ lsof -p 29363 | grep cwd
java 29363 oracle cwd DIR 252,4 4096 4850871 /u01/app/oracle/oic/prod
Kill the process.
$ kill -9 8113
Wait for 120 seconds before restarting the agent. This is so the process has time to properly terminate.
$ sleep 120
I did attempt to rename the connectivity agent jar files to include the words prod and test. This would make it easy to distinguish between the two. This did not work. The connectivity agent would crash almost immediately. I’ll have to investigate it further.
Summary
In conclusion, the starting and stopping of the Oracle Integration connectivity agent is easy. I’ll be looking at automating the stopping and starting of these with a script. This will make it faster and eliminate any potential for human errors.