Example of using MODIFY_SYSTEM to start/stop/restart agents


Article ID: 209436


Updated On:


CA Automic One Automation


This article details an example of using a single script object that takes advantage of the MODIFY_SYSTEM script function to choose an agent and then stop, start, or restart the agent.  This is just an example, for actual implementation, advice from the community or an implementation partner may be needed.




Release : 12.3



Please see the xml export attached to this article.

There are four objects here for an example:

1) VARA.AGENT_LIST - this is a static agent that has a list of Agents in it and is used by the promptset in #3 below to determine which agent should have action taken. A SQL variable could also be used to get an agent list.
2) VARA.RESTART_AGENT.RESTART_TYPE - this variable is used by the promptset in #3 below to determine which type of action should be taken: STOP, START, RESTART
3) PRPT.RESTART_AGENT - this is a prompset that allows to choose the agent from #1 above and the type of action from #2 above
4) SCRI.RESTART_AGENT - this is the script that actually takes the action based on the prompts.  It uses the following statements:
:    set &ret# = MODIFY_SYSTEM("STARTUP", &agent_name#)
:    set &ret# = MODIFY_SYSTEM("TERMINATE", &agent_name#)

The script object from #4 above can be executed and when doing so, an agent can be chosen from the agent dropdown and then a type of action to be taken.

There is a requirement that the agent be started using the service manager component and the service manager information must be available in client 0 for that agent.

Additional Information

More information about the MODIFY_SYSTEM script function can be found here: https://docs.automic.com/documentation/webhelp/english/AA/12.3/DOCU/12.3/Automic%20Automation%20Guides/help.htm#Script/Reference/MODIFY_SYSTEM.htm   under the "Service Manager" section

Information on linking agents to the service manager in client 0 can be found here: https://docs.automic.com/documentation/webhelp/english/AA/12.3/DOCU/12.3/Automic%20Automation%20Guides/help.htm#AWA/AdministrationPerspective/AG_agents.htm#link9


1614379276649__script-stop-start-restart-agent.xml get_app