Raspbian服务“ googlesamples-assistant-hotword”在启动时无法启动

时间:2018-10-16 20:25:00

标签: raspberry-pi raspbian google-assistant-sdk

我在raspbian的raspberry pi上安装了Google助手SDK。

在使sdk运行后,我提供了一项服务以在raspbian中自动运行,启动了“ googlesamples-assistant-hotword”的命令,但在启动时该服务未启动并给出错误消息,但是如果我将命令提供给服务启动有效。

这是带有googlesamples-assistant-hotword命令的脚本(我输入了正确的project-id e和device-model-id)

start_assistant.sh

#!/bin/bash

source /home/pi/env/bin/activate
googlesamples-assistant-hotword --project-id ************ --device-model-id **********************

以及服务文件:

[Unit]
Description=Google Assistant
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/bin/bash /home/pi/start_assistant.sh
Restart=on
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=Google Assistant

[Install]
WantedBy=multi-user.target`

但是在启动时服务不会运行,并显示以下错误消息:

`pi@raspberrypi:~ $ sudo systemctl status assistant.service
● assistant.service - Google Assistant
   Loaded: loaded (/lib/systemd/system/assistant.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-10-16 13:42:12 -03; 1min 44s ago
  Process: 422 ExecStart=/bin/bash /home/pi/start_assistant.sh (code=exited, status=1/FAILURE)
 Main PID: 422 (code=exited, status=1/FAILURE)

out 16 13:42:12 raspberrypi Google Assistant[422]:     response_data = _token_endpoint_request(request, token_uri, body)
out 16 13:42:12 raspberrypi Google Assistant[422]:   File "/home/pi/env/lib/python3.5/site-packages/google/oauth2/_client.py", line 106, in _token_en
out 16 13:42:12 raspberrypi Google Assistant[422]:     method='POST', url=token_uri, headers=headers, body=body)
out 16 13:42:12 raspberrypi Google Assistant[422]:   File "/home/pi/env/lib/python3.5/site-packages/google/auth/transport/requests.py", line 124, in 
out 16 13:42:12 raspberrypi Google Assistant[422]:     six.raise_from(new_exc, caught_exc)
out 16 13:42:12 raspberrypi Google Assistant[422]:   File "<string>", line 3, in raise_from
out 16 13:42:12 raspberrypi Google Assistant[422]: google.auth.exceptions.TransportError: HTTPSConnectionPool(host='accounts.google.com', port=443): 
out 16 13:42:12 raspberrypi systemd[1]: assistant.service: Main process exited, code=exited, status=1/FAILURE
out 16 13:42:12 raspberrypi systemd[1]: assistant.service: Unit entered failed state.
out 16 13:42:12 raspberrypi systemd[1]: assistant.service: Failed with result 'exit-code'.`

但是,如果我给出启动服务的命令,则服务运行正常,如下所示:

`@raspberrypi:~ $ sudo systemctl start assistant.service
pi@raspberrypi:~ $ sudo systemctl status assistant.service
● assistant.service - Google Assistant
   Loaded: loaded (/lib/systemd/system/assistant.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-16 13:45:13 -03; 2s ago
 Main PID: 972 (bash)
   CGroup: /system.slice/assistant.service
           ├─972 /bin/bash /home/pi/start_assistant.sh
           └─976 /home/pi/env/bin/python /home/pi/env/bin/googlesamples-assistant-hotword --project-id *********** --device-model-id ************

out 16 13:45:13 raspberrypi systemd[1]: Started Google Assistant.
`

有人知道我在这里想念...吗? 我必须做什么才能在raspbian boot中正常运行该服务??

PS :。我给出了启用服务的命令,但是却无法像您在错误状态中看到的那样工作。

0 个答案:

没有答案