
나는 이것을 아주 간단하게 가지고 있습니다 systemd
.
[Unit]
Description="Something"
[Service]
Type=simple
ExecStart=/bin/systemctl restart nginx
를 사용하여 실행하려고 systemctl start my-script.service
하고 을 사용하여 쿼리하면 systemctl status my-script.service
상태가 표시되며 Loaded
영원히 표시됩니다.
느낌이 있는데 문제는 systemctl
내부에서 사용하고 싶다는 것입니다 systemd
.
답변1
systemctl status
해당 시점에 실제로 systemd에 로드되었기 때문에 서비스에 대해 "로드됨"으로 보고됩니다. 나는 당신이 또 무엇을 기대하고 있는지 잘 모르겠습니다. 귀하의 서비스를 직접 시작해 보았는데 예상대로 작동하여 Nginx 서비스를 다시 시작했습니다.
$ journalctl | tail -10
Apr 27 12:39:28 myhost.com systemd[1]: Started "Something".
Apr 27 12:39:28 myhost.com systemd[1]: Stopping A high performance web server and a reverse proxy server...
Apr 27 12:39:28 myhost.com systemd[1]: Stopped A high performance web server and a reverse proxy server.
Apr 27 12:39:28 myhost.com systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 27 12:39:28 myhost.com systemd[1]: Started A high performance web server and a reverse proxy server.
시스템 서비스 파일이 예상대로 작동하지 않는 경우 질문을 좀 더 구체적으로 작성해 주세요.