Linux Agent: Systemd Service stop also ends currently running jobs
search cancel

Linux Agent: Systemd Service stop also ends currently running jobs

book

Article ID: 204748

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation

Issue/Introduction

In recent Linux OS, Systemd services are used instead of init.d services.

Example of a configuration with Systemd service for the Automic Service Manager to autostart / autostop the Linux Agent upon system shutdown/startup.

cat /usr/lib/systemd/system/automicsm.service

#################################################
[Unit]
Description=Automic Service Manager
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
User=uc4exe
ExecStart=/opt/Automic/automicsm start
ExecStop=/opt/Automic/automicsm stop

[Install]
WantedBy=default.target

#####################################################

 

#####################################################

# systemctl status automicsm

 automicsm.service - Automic Service Manager
   Loaded: loaded (/opt/Automic/automicsm.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2020-09-08 14:37:00 CEST; 2 months 21 days ago
 Main PID: 21347 (code=exited, status=0/SUCCESS)
    Tasks: 989
   CGroup: /system.slice/automicsm.service
           |-  590 dw.<sap system>pf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |-  751 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |-  759 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |-  787 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |-  794 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |-  800 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |- 1461 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>
           |- 2340 /usr/sap/xyz/sap_system/exe/jstart -appTrc -nodeId=3 pf=/usr/sap/xyz/SYS/profile/<sap system/service>-DSAPINFO=xyz>
           |- 2341 /usr/sap/xyz/sap_system/exe/jstart -appTrc -nodeId=2 pf=/usr/sap/xyz/SYS/profile/<sap system/service>-DSAPINFO=xyz>
           |- 2481 dw.<sap system&gtpf=/usr/sap/xyz/SYS/profile/<sap system/service>

When we stop this service using systemctl, all the subprocesses (running Jobs) are also stopped.

How can we change this behavior?

Environment

Release : 12.3

Component : AUTOMATION ENGINE

Cause

Not Automic related, systemd service configuration related.

Resolution

The Systemd services collide all subprocesses into a cgroup (control group).
This provokes that stopping the Automic systemd service it will stop all the subprocesses (like the currently running jobs) at the same time.
This is the nature of the systemd services and should possibly be changed by modifying the service definition.
In order to avoid this, use an init.d script service instead.