![为什么我的 ubuntu 服务超时了,因为我可以清楚地看到它已正确启动?](https://linux22.com/image/763333/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E7%9A%84%20ubuntu%20%E6%9C%8D%E5%8A%A1%E8%B6%85%E6%97%B6%E4%BA%86%EF%BC%8C%E5%9B%A0%E4%B8%BA%E6%88%91%E5%8F%AF%E4%BB%A5%E6%B8%85%E6%A5%9A%E5%9C%B0%E7%9C%8B%E5%88%B0%E5%AE%83%E5%B7%B2%E6%AD%A3%E7%A1%AE%E5%90%AF%E5%8A%A8%EF%BC%9F.png)
这是我的日志:
Feb 10 10:19:25 ip-172-31-47-29 systemd[1]: Starting TNR Photo Download Service...
Feb 10 10:19:26 ip-172-31-47-29 tnr-photos[67938]: Server running on port 2200
Feb 10 10:20:56 ip-172-31-47-29 systemd[1]: tnr-photos.service: start operation timed out. Terminating.
Feb 10 10:20:56 ip-172-31-47-29 systemd[1]: tnr-photos.service: Failed with result 'timeout'.
Feb 10 10:20:56 ip-172-31-47-29 systemd[1]: Failed to start TNR Photo Download Service.
Feb 10 10:21:01 ip-172-31-47-29 systemd[1]: tnr-photos.service: Scheduled restart job, restart counter is at 14.
Feb 10 10:21:01 ip-172-31-47-29 systemd[1]: Stopped TNR Photo Download Service.
Feb 10 10:21:01 ip-172-31-47-29 systemd[1]: Starting TNR Photo Download Service...
Feb 10 10:21:01 ip-172-31-47-29 tnr-photos[67988]: Server running on port 2200
Feb 10 10:22:31 ip-172-31-47-29 systemd[1]: tnr-photos.service: start operation timed out. Terminating.
Feb 10 10:22:31 ip-172-31-47-29 systemd[1]: tnr-photos.service: Failed with result 'timeout'.
Feb 10 10:22:31 ip-172-31-47-29 systemd[1]: Failed to start TNR Photo Download Service.
Feb 10 10:22:36 ip-172-31-47-29 systemd[1]: tnr-photos.service: Scheduled restart job, restart counter is at 15.
Feb 10 10:22:36 ip-172-31-47-29 systemd[1]: Stopped TNR Photo Download Service.
Feb 10 10:22:36 ip-172-31-47-29 systemd[1]: Starting TNR Photo Download Service...
Feb 10 10:22:37 ip-172-31-47-29 tnr-photos[68036]: Server running on port 2200
Feb 10 10:24:07 ip-172-31-47-29 systemd[1]: tnr-photos.service: start operation timed out. Terminating.
Feb 10 10:24:07 ip-172-31-47-29 systemd[1]: tnr-photos.service: Failed with result 'timeout'.
Feb 10 10:24:07 ip-172-31-47-29 systemd[1]: Failed to start TNR Photo Download Service.
Feb 10 10:24:12 ip-172-31-47-29 systemd[1]: tnr-photos.service: Scheduled restart job, restart counter is at 16.
Feb 10 10:24:12 ip-172-31-47-29 systemd[1]: Stopped TNR Photo Download Service.
Feb 10 10:24:12 ip-172-31-47-29 systemd[1]: Starting TNR Photo Download Service...
Feb 10 10:24:12 ip-172-31-47-29 tnr-photos[68068]: Server running on port 2200
Feb 10 10:25:42 ip-172-31-47-29 systemd[1]: tnr-photos.service: start operation timed out. Terminating.
Feb 10 10:25:42 ip-172-31-47-29 systemd[1]: tnr-photos.service: Failed with result 'timeout'.
Feb 10 10:25:42 ip-172-31-47-29 systemd[1]: Failed to start TNR Photo Download Service.
Feb 10 10:25:47 ip-172-31-47-29 systemd[1]: tnr-photos.service: Scheduled restart job, restart counter is at 17.
Feb 10 10:25:47 ip-172-31-47-29 systemd[1]: Stopped TNR Photo Download Service.
Feb 10 10:25:47 ip-172-31-47-29 systemd[1]: Starting TNR Photo Download Service...
Feb 10 10:25:48 ip-172-31-47-29 tnr-photos[68101]: Server running on port 2200
该服务定义如下:
[Unit]
Description=TNR Photo Download Service
After=network.target
[Service]
Type=forking
User=ubuntu
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=tnr-photos
WorkingDirectory=/home/ubuntu/tnr-web-photos
ExecStart=sudo /usr/bin/node /home/ubuntu/tnr-web-photos/index.js
[Install]
WantedBy=multi-user.target
这是一个非常简单的nodeJS
服务器,所有的行都tnr-photos[68101]: Server running on port 2200
表明它实际上正在正常启动。
怎么老是超时?