iniciando um serviço resulta em erro 'Tempo de espera do serviço' - não é possível localizar o caminho do python

0

Quando eu inicio o serviço e verifico imediatamente o status sudo systemctl status myservice ele parece estar ativo e começa a funcionar, mas depois de alguns segundos ele muda para Failed to start service e mostra

 Failed with result exit code
 Service hold-off time over sheduling restart
 Stopped service
 Start request repeated too quickly
 Failed to start service

O arquivo:

[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

Uma coisa que vem em mente é que, para que o script comece a ser executado (o run.sh em / opt / df), ele precisa de cerca de um minuto ou mais.

Não tenho certeza se isso tem a ver com esse problema.

------------ UPDATE ---------------

Hmm..Eu corro journalctl -xe e encontrei:

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

Se eu apenas executar o script (o run.sh sem serviço):

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))
....

Então, parece que o serviço não pode encontrar o caminho correto do python? (o caminho da anaconda que estou usando)

    
por George 02.08.2016 / 15:47

0 respostas