systemd 서비스 상태는 항상 활성 상태입니다.

systemd 서비스 상태는 항상 활성 상태입니다.

systemd 서비스에 문제가 있습니다. 스크립트 상태는 항상 "활성"이 아닌 "활성화됨"입니다. 문제가 무엇인지 잘 모르겠습니다. 이 문제를 해결하도록 도와주세요.

30초마다 bash 스크립트를 실행하는 systemd 서비스를 만들었습니다.

My script : 
#!/bin/bash
PGPORT=$1
echo "running through bash script thourgh  systemd working `date`" >> //tmp/diditwork.txt

내 시스템 서비스 구성

[root@pglinux02 system]# cat /etc/systemd/system/test-pg.service
[Unit]
Description=PostgreSQL db Service
After=network.target

[Service]
User=postgres
Type=simple
ExecStart=/tmp/test.sh 5432
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
[root@pglinux02 system]#

내 스크립트가 예상대로 실행되고 있지만 서비스 상태를 확인하면 항상 "활성화 중" 상태가 표시됩니다.

[root@pglinux02 system]# systemctl status test-pg.service
● test-pg.service - PostgreSQL db Service 
   Loaded: loaded (/etc/systemd/system/test-pg.service; enabled; vendor preset: disabled)
   Active: **activating (auto-restart)** since Fri 2021-10-29 19:49:57 GMT; 6s ago
  Process: 5274 ExecStart=/tmp/test.sh 5432 (code=exited, status=0/SUCCESS)
 Main PID: 5274 (code=exited, status=0/SUCCESS)
[root@pglinux02 system]#

이 서비스를 "활성(실행)"으로 만드는 방법은 무엇입니까? 다른 매개변수 "RemainAfterExit=yes"를 추가하면 스크립트가 처음 실행되고 이후 간격에서는 다시 실행되지 않습니다.

내 오류와 해결책을 지적해주세요.

감사합니다 두르가

관련 정보