Data Backup and Recovery

scAgent SuSe Linux systemd service

vollmerbc
4,100 Views

We are using SuSe Linux 12.1 which uses systemd for service daemons.

We need to start scAgent with the OS (reboot, auto restart on scAgent error)

 

For scAgent 4.3.0 there is only info available for sysvinit which doesn't match for systemd.

 

 

We have created the following script/usr/lib/systemd/system/ScAgent.service

 

[Unit]
Description=Snapcreator Agent

[Service]
ExecStart=/opt/snapcreator/scAgent4.3.0/bin/scAgent start
ExecStop=/opt/snapcreator/scAgent4.3.0/bin/scAgent stop

[Install]
WantedBy=multi-user.target

When we run the service it stops automatically:

 

Running:

scAgent.service - Snapcreator Agent
   Loaded: loaded (/usr/lib/systemd/system/scAgent.service; enabled)
   Active: active (running) since Mo 2017-09-11 08:25:17 CEST; 1s ago
  Process: 26190 ExecStop=/opt/snapcreator/scAgent4.3.0/bin/scAgent stop (code=exited, status=0/SUCCESS)
 Main PID: 26282 (scAgent)
   CGroup: /system.slice/scAgent.service
           ├─26282 /bin/sh /opt/snapcreator/scAgent4.3.0/bin/scAgent start
           ├─26312 java -Xms32m -Xmx128m -XX:MaxPermSize=64m -classpath /opt/snapcreator/scAgent4.3.0/lib/scAgent-4.3-core.jar com.netapp.snapcreator.agent.nextgen.watchdog.external.ExternalWatchdogStarter start
           ├─26313 sleep 10
           └─26343 java -Xms64m -Xmx256m -XX:MaxPermSize=128m -DINSTALL_PATH=/opt/snapcreator/scAgent4.3.0 -classpath /opt/snapcreator/scAgent4.3.0/lib/scAgent-4.3-core.jar:/opt/snapcreator/scAgent4.3.0/lib/cxf-rt-tr...

Sep 11 08:25:17  systemd[1]: Started Snapcreator Agent.
Sep 11 08:25:17  scAgent[26282]: Starting scAgent:

Stopped (see timestamps):

scAgent.service - Snapcreator Agent
   Loaded: loaded (/usr/lib/systemd/system/scAgent.service; enabled)
   Active: inactive (dead) since Mo 2017-09-11 08:25:28 CEST; 6s ago
  Process: 26403 ExecStop=/opt/snapcreator/scAgent4.3.0/bin/scAgent stop (code=exited, status=0/SUCCESS)
  Process: 26282 ExecStart=/opt/snapcreator/scAgent4.3.0/bin/scAgent start (code=exited, status=0/SUCCESS)
 Main PID: 26282 (code=exited, status=0/SUCCESS)

Sep 11 08:25:17  systemd[1]: Started Snapcreator Agent.
Sep 11 08:25:17  scAgent[26282]: Starting scAgent:
Sep 11 08:25:27  scAgent[26282]: Watchdog: Running
Sep 11 08:25:27  scAgent[26282]: Agent: Running
Sep 11 08:25:27  scAgent[26403]: Shutting down scAgent:
Sep 11 08:25:28  scAgent[26403]: Watchdog: Stopped
Sep 11 08:25:28  scAgent[26403]: Agent: Stopped

When we check the scAgent script directly with

scAgent status

it seems to run as long as the service ist running and then is stopped after the systemd service stops.

 

 

running:

 

#systemctl start scAgent.service
#./scAgent status Checking Status of scAgent: Watchdog: Running Agent: Running

after a few seconds:

 

#./scAgent status

Checking Status of scAgent:
    Watchdog: Stopped
       Agent: Stopped

 

As long as we run 'scAgent start' dircectly/without systemd it is running fine...

 

Does anybody have a solution to this?

Are the scripts at /bin not intended to be used with s systemd script?

1 ACCEPTED SOLUTION

IS4IT
3,889 Views

it works with this systemd config:

 

[Service]
ExecStart=/opt/NetApp/scAgent4.3.1/bin/scAgent start
RemainAfterExit=yes
ExecStop=/opt/NetApp/scAgent4.3.1/bin/scAgent stop

View solution in original post

2 REPLIES 2

IS4IT
3,890 Views

it works with this systemd config:

 

[Service]
ExecStart=/opt/NetApp/scAgent4.3.1/bin/scAgent start
RemainAfterExit=yes
ExecStop=/opt/NetApp/scAgent4.3.1/bin/scAgent stop

vollmerbc
3,848 Views

Thank you!

Public