서비스를 시작하고 바로 상태를 확인해보면 sudo systemctl status myservice
활성화된 것처럼 나타나서 실행되기 시작하는데, 몇 초 후에 로 이동하여 Failed to start service
표시됩니다.
Failed with result exit code
Service hold-off time over sheduling restart
Stopped service
Start request repeated too quickly
Failed to start service
문서:
[Unit]
Description=myservice
[Service]
ExecStart=/bin/sh /opt/df/run.sh -pidfile=/var/run/myservice.pid
Restart=always
RestartSec=60
SyslogIdentifier=myservice
[Install]
WantedBy=multi-user.target
한 가지 명심해야 할 점은 스크립트 실행(/opt/df의 run.sh)을 시작하는 데 약 1분 이상 소요된다는 것입니다.
이것이 문제와 관련이 있는지 확실하지 않습니다.
- - - - - - 갱신- - - - - - - -
흠..달려가서 journalctl -xe
발견한 것:
Activating virtualenv at .venv
Ignoring indexes: https://pypi.python.org/simple
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in runwb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 448, in _prepare_file
req_to_install, finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 387, in _check_skip_installed
req_to_install.check_if_exists()
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1011, in check_if_exists
self.req.project_name
AttributeError: 'Requirement' object has no attribute 'project_name'
myservice.service: Main process exited, code=exited, status=1/FAILURE
방금 스크립트를 실행하는 경우(서비스 없이 run.sh):
Activating virtualenv at .venv
Ignoring indexes: https://pypi.python.org/simple
Requirement already up-to-date: pip==8.0.2+gx2 in ~/.local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): bx-python==0.7.3 in ~/anaconda2/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe==0.23 in ~/anaconda2/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): PyYAML==3.11 in ~/anaconda2/lib/python2.7/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): SQLAlchemy==1.0.8 in ~/anaconda2/lib/python2.7/site-packages (from -r requirements.txt (line 5))
....
그렇다면 서비스가 올바른 Python 경로를 찾을 수 없는 것 같습니다. (내가 사용하는 아나콘다 경로)?