sh 此bash脚本为在Raspberry Pi 3上运行的Google智能助理创建系统单元文件和启动文件。还启用并启动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 此bash脚本为在Raspberry Pi 3上运行的Google智能助理创建系统单元文件和启动文件。还启用并启动相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# instructions:
# download this script to '/home/pi/' on your Raspberry Pi 3
# run 'sudo chmod +x assistant-autolaunch-config.sh'
# run 'sudo ./assistant-autolaunch-config.sh'
# now the Google Assistant will start automatically upon system boot

echo -e "\nConfiguring Google Assistant for auto-launch at boot..."

sudo touch /home/pi/launch-assistant.sh

echo -e "#!/bin/bash
source /home/pi/env/bin/activate
google-assistant-demo" > /home/pi/launch-assistant.sh

sudo chmod +x /home/pi/launch-assistant.sh

echo -e "\nCreated 'launch-assistant.sh' file at '/home/pi/'"

sudo touch /lib/systemd/system/launch-assistant.service

echo -e "[Unit]
Description=Google Assistant Demo App
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/home/pi/launch-assistant.sh
User=pi

[Install]
WantedBy=multi-user.target" > /lib/systemd/system/launch-assistant.service

echo -e "\nCreated 'launch-assistant.service' Unit file at '/lib/systemd/system/'"

echo -e "\nEnabling 'launch-assistant.service'...\n"

sudo systemctl enable launch-assistant.service
sudo systemctl start launch-assistant.service
sudo systemctl status launch-assistant.service

echo -e "\nStarted Google Assistant! Say 'Ok Google'\n"

以上是关于sh 此bash脚本为在Raspberry Pi 3上运行的Google智能助理创建系统单元文件和启动文件。还启用并启动的主要内容,如果未能解决你的问题,请参考以下文章

sh 使用作为cronjob启动的脚本创建Raspberry Pi备份

sh 在启动时通过电子邮件(使用Mandrill)发送eth0本地IP(192.xxx)的脚本(对Raspberry Pi很有用)

sh 在启动时通过电子邮件(使用Mandrill)发送eth0本地IP(192.xxx)的脚本(对Raspberry Pi很有用)

Raspberry Pi 4B 开机自动运行Python文件

使用 CLI omxplayer 调整音频音量级别 - Raspberry Pi

Raspberry pi 中的 Crontab 不会运行非常简单的脚本