Centos 7에서 initd 스크립트를 포크할 수 없습니다. 서비스를 시작하기 위해 initd 스크립트가 내장되어 있는 JBOSS EAP7을 설치했습니다. 아래와 같이 서비스를 시작/중지/다시 시작했는데 제대로 작동합니다. 그러나 systemd를 통해 동일한 initd 스크립트를 포크하면 작동하지 않습니다. 어떤 도움이라도 대단히 감사하겠습니다.
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh start
Starting jboss-eap: /root
[ OK ]
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh status
jboss-eap is running (pid 3024)
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh stop
Stopping jboss-eap: [ OK ]
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh status
jboss-eap is not running
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh start
Starting jboss-eap: /root
[ OK ]
# /opt/jboss/bin/init.d/jboss-eap-rhel.sh status
jboss-eap is running (pid 3314)
systemd를 통해 동일한 initd 스크립트를 분기하면 오류가 발생합니다.
# cat /etc/systemd/system/jbosseap7.service
[Unit]
Description=JBoss EAP7
After=syslog.target
After=network.target
[Service]
Type=forking
ExecStart=/opt/jboss/bin/init.d/jboss-eap-rhel.sh start
ExecStop=/opt/jboss/bin/init.d/jboss-eap-rhel.sh stop
ExecReload=/opt/jboss/bin/init.d/jboss-eap-rhel.sh restart
PIDFile=/var/run/jboss-eap/jboss-eap-standalone.pid
[Install]
WantedBy=multi-user.target
# time systemctl start jbosseap7
Job for jbosseap7.service failed because a timeout was exceeded. See "systemctl status jbosseap7.service" and "journalctl -xe" for details.
real **1m27.330s**
user 0m0.008s
sys 0m0.003s
# time systemctl status jbosseap7
● jbosseap7.service - JBoss EAP7
Loaded: loaded (/etc/systemd/system/jbosseap7.service; enabled; vendor preset: disabled)
Active: failed (Result: timeout) since Mon 2018-06-11 07:04:29 EDT; 15s ago
Jun 11 06:58:22 node01.local.com systemd[1]: Starting JBoss EAP7...
Jun 11 06:58:22 node01.local.com runuser[4071]: pam_unix(runuser:session): session opened for user jboss by (uid=0)
Jun 11 06:58:22 node01.local.com jboss-eap-rhel.sh[4060]: Starting jboss-eap: /
Jun 11 06:58:39 node01.local.com jboss-eap-rhel.sh[4060]: [ OK ]
Jun 11 06:58:39 node01.local.com systemd[1]: PID file /var/run/jboss-eap/jboss-eap-standalone.pid not readable (yet?) after start.
Jun 11 07:04:28 node01.local.com systemd[1]: jbosseap7.service start operation timed out. Terminating.
Jun 11 07:04:29 node01.local.com systemd[1]: Failed to start JBoss EAP7.
Jun 11 07:04:29 node01.local.com systemd[1]: Unit jbosseap7.service entered failed state.
Jun 11 07:04:29 node01.local.com systemd[1]: jbosseap7.service failed.
real 0m0.045s
user 0m0.004s
sys 0m0.000s
노트:[SERVICE] 단위 아래에 시간 초과 제한을 지정해 보았지만 여전히 작동하지 않습니다. 시간 제한을 지정하지 않으면 여전히 오랜 시간(1분 27초)이 걸립니다. 여기서 무엇이 잘못될 수 있나요?
추가 댓글:
시작될 때도 있고 그렇지 않을 때도 있습니다. 어느 것이 실패했는지 어떻게 확인할 수 있습니까?
# systemctl start jbosseap7
# systemctl status jbosseap7
● jbosseap7.service - JBoss EAP7
Loaded: loaded (/etc/systemd/system/jbosseap7.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2018-06-11 07:32:47 EDT; 7s ago
Process: 2913 ExecStop=/etc/init.d/jboss-eap-rhel.sh stop (code=exited, status=0/SUCCESS)
Process: 2771 ExecStart=/etc/init.d/jboss-eap-rhel.sh start (code=exited, status=0/SUCCESS)
Main PID: 2537 (code=exited, status=0/SUCCESS)
Jun 11 07:32:15 node01.local.com systemd[1]: Starting JBoss EAP7...
Jun 11 07:32:15 node01.local.com runuser[2782]: pam_unix(runuser:session): session opened for user jboss by (uid=0)
Jun 11 07:32:15 node01.local.com jboss-eap-rhel.sh[2771]: Starting jboss-eap: /
Jun 11 07:32:46 node01.local.com jboss-eap-rhel.sh[2771]: jboss-eap started with errors, please see server log for details
Jun 11 07:32:46 node01.local.com jboss-eap-rhel.sh[2771]: [ OK ]
Jun 11 07:32:47 node01.local.com jboss-eap-rhel.sh[2913]: Stopping jboss-eap: [ OK ]
Jun 11 07:32:47 node01.local.com systemd[1]: Started JBoss EAP7.
# ps -ef | grep jboss
root 2924 2222 0 07:33 pts/0 00:00:00 grep --color=auto jboss
# systemctl start jbosseap7
# systemctl status jbosseap7
● jbosseap7.service - JBoss EAP7
Loaded: loaded (/etc/systemd/system/jbosseap7.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-06-11 07:33:35 EDT; 3s ago
Process: 2913 ExecStop=/etc/init.d/jboss-eap-rhel.sh stop (code=exited, status=0/SUCCESS)
Process: 2930 ExecStart=/etc/init.d/jboss-eap-rhel.sh start (code=exited, status=0/SUCCESS)
Main PID: 2943 (standalone.sh)
CGroup: /system.slice/jbosseap7.service
├─2943 /bin/sh /opt/jboss/bin/standalone.sh -c standalone.xml
└─3012 java -D[Standalone] -server -verbose:gc -Xloggc:/opt/jboss/standalone/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:Nu...
Jun 11 07:33:19 node01.local.com systemd[1]: Starting JBoss EAP7...
Jun 11 07:33:19 node01.local.com runuser[2941]: pam_unix(runuser:session): session opened for user jboss by (uid=0)
Jun 11 07:33:19 node01.local.com jboss-eap-rhel.sh[2930]: Starting jboss-eap: /
Jun 11 07:33:35 node01.local.com jboss-eap-rhel.sh[2930]: [ OK ]
Jun 11 07:33:35 node01.local.com systemd[1]: Started JBoss EAP7.
PS 결과:
# ps -aux|grep jboss
jboss 4559 0.0 0.0 113120 1540 ? S 07:58 0:00 /bin/sh /opt/jboss/bin/standalone.sh -c standalone.xml
jboss 4628 49.4 33.9 3077608 640432 ? Sl 07:58 0:15 java -D[Standalone] -server -verbose:gc -Xloggc:/opt/jboss/standalone/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/jboss/standalone/log/server.log -Dlogging.configuration=file:/opt/jboss/standalone/configuration/logging.properties -jar /opt/jboss/jboss-modules.jar -mp /opt/jboss/modules org.jboss.as.standalone -Djboss.home.dir=/opt/jboss -Djboss.server.base.dir=/opt/jboss/standalone -c standalone.xml
root 4754 0.0 0.0 112644 952 pts/0 R+ 07:58 0:00 grep --color=auto jboss
답변1
systemctl 데몬의 로그를 보면 jboss의 pid 파일을 읽으려고 시도하고 있는 것이 분명합니다.
따라서 먼저 pid 파일을 삭제하십시오.
rm /var/run/jboss-eap/jboss-eap-standalone.pid
이제 다음 줄을 주석 처리하고 데몬을 다시 로드합니다.
#PIDFile=/var/run/jboss-eap/jboss-eap-standalone.pid
systemctl daemon-reload
그런 다음 jboss 서비스를 시작하십시오.
systemctl start jbosseap7