systemd o estado muda para “desativando (stop-sigterm)” para a unidade com type = forking

1

Eu escrevi uma unidade systemd para iniciar meu aplicativo na inicialização:

cat [email protected]

[Unit]
Description=Start my application
After=local-fs.target network.target

[Service]
WorkingDirectory=/apps/scope
ExecStart=/apps/scope/scripts/startAtBoot.sh
Type=forking
PIDFile=/apps/scope/scripts/startAtBoot.pid
User=%i
#Group=
TimeoutSec=30min

[Install]
WantedBy=multi-user.target

cat /apps/scope/scripts/startAtBoot.sh

#!/bin/bash
#### Description: Startup applications at system reboot
#set -x

(. ~/.bash_profile && /apps/scope/scripts/envMaint.sh start >> /apps/scope/ca/profile-root/runtime/logs/envMaint-'date +\%m\%d'.log 2>&1)&
echo $! > /apps/scope/scripts/startAtBoot.pid

Quando inicio este serviço:
[root@alvd17p01 ~]# systemctl start [email protected]

Eu posso ver o processo pai e filho sendo executado por algum tempo.

[root@alvd17p01 ~]# systemctl status [email protected][email protected] - Start my application
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2017-08-24 19:12:28 EDT; 13s ago
   Process: 127914 ExecStart=/apps/scope/scripts/startAtBoot.sh (code=exited, status=0/SUCCESS)
   Main PID: 127915 (startAtBoot)
   CGroup: /system.slice/system-myproc.slice/[email protected]
           ├─127915 /bin/bash /apps/scope/scripts/startAtBoot.sh
           ├─127927 /bin/sh /apps/scope/scripts/envMaint.sh start
           ├─127951 /bin/sh ./start.sh
           ├─127952 /bin/sh ./scpp-ant.sh start
           ├─127953 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/bin/java -classpath ...
           └─127982 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/bin/java -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -XX:PermSize=64M -XX:MaxPermSize=512M -Xms1024...

Mas depois de alguns minutos, as unidades indicam mudanças para desativar (stop-sigterm)

[root@alvd17p01 ~]# systemctl status [email protected][email protected] - Start my application
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) since Thu 2017-08-24 19:14:24 EDT; 2s ago
   Process: 127914 ExecStart=/apps/scope/scripts/startAtBoot.sh (code=exited, status=0/SUCCESS)
   Main PID: 127915 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/system-myproc.slice/[email protected]
           ├─128115 /bin/sh /3rdparty/swtools/jboss-eap-6.4.1/bin/standalone.sh -Dscpp.server.name=app -Djboss.server.base.dir=/apps/scope/app/profile-root/runtime/profile
           └─128247 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/bin/java -D[Standalone] -server -XX:+UseCompressedOops -verbose:gc -Xloggc:/apps/scope/app/profile-root/runtime/logs/gc.log -XX...

[root@alvd17p01 ~]# systemctl status [email protected][email protected] - Start my application
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: inactive (dead)

Não consigo entender por que isso deve falhar. Meu envMaint.sh, sai com status 0. startAtBoot.pid tem pid de processo filho.

Alguma ajuda sobre o que eu fiz de errado?

    
por theSTIG 25.08.2017 / 02:02

0 respostas