Restart scx agent from task

Berg, Ronald van den 46 Reputation points
2021-06-17T14:36:15.907+00:00

I would like to be able to restart a scx agent from the scom taskpane.

I've created the task like this:
<Task ID="RestartSCXAgent2" Accessibility="Internal" Enabled="true" Target="Unix!Microsoft.Unix.Computer" Timeout="12000" Remotable="true">
<Category>Custom</Category>
<ProbeAction ID="PA" TypeID="Unix!Microsoft.Unix.WSMan.Invoke.VarPriv.ProbeAction">
<TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>
<UserName>$RunAs[Name="Unix!Microsoft.Unix.PrivilegedAccount"]/UserName$</UserName>
<Password>$RunAs[Name="Unix!Microsoft.Unix.PrivilegedAccount"]/Password$</Password>
<Uri>http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx</Uri>
<Selector />
<InvokeAction>ExecuteShellCommand</InvokeAction>
<Input><p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"><p:command>/usr/bin/nohup /opt/microsoft/scx/bin/tools/scxadmin -restart</p:command><p:timeout>120</p:timeout></p:ExecuteShellCommand_INPUT></Input>
<TimeOutInMS>12000</TimeOutInMS>
</ProbeAction>
</Task>

But the issue is that the agent will stop but don't start. The agent probably kills the start task on stopping, that's why i added the nohup which i thought would prevent that but it won't.
Anyone a idea or a working task that performs an agent restart?

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,469 questions
0 comments No comments
{count} votes

Accepted answer
  1. AlexZhu-MSFT 5,871 Reputation points Microsoft Vendor
    2021-06-18T02:25:41.41+00:00

    Hi,

    It seems this is a question about logic. Per my understanding, we can run any command, other than restart/stop the agent command, which will break the running environment. The restart/start agent command should be run at OS level, for example, crond. To confirm this, we can run other commands, for example, ps -e | grep omi to see if it works.

    <p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"><p:command>ps -e | grep omi</p:command><p:timeout>120</p:timeout></p:ExecuteShellCommand_INPUT>
    

    Alex
    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Berg, Ronald van den 46 Reputation points
    2021-06-18T05:08:06.387+00:00

    Yes, i'm afraid this has to be it, i was hoping the nohup would keep the proces running but apperently not.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.