zoukankan      html  css  js  c++  java
  • 17使用systemd方式开机自动启动Home Assistant服务

    2018-03-20 15:48:36

    转移自网易博客!

    首先使用编写文件hass@homeassistant.service,文件内容如下

    # 这个文件用于systemd方式自动启动hass服务。
    # 这个文件实际是/usr/lib/systemd/system/hass@homeassistant.service,使用下面的命令创建开机自动启动服务。
    # sudo systemctl --system daemon-reload
    # sudo systemctl enable hass@homeassistant
    # sudo systemctl disable hass@homeassistant
    # sudo systemctl start hass@homeassistant
    #
    #
    # 参考http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html教程建立,更符合linux的常规做法。
    # 文件内的命令参考以下内容编写
    # 使用手动安装Home Assistant 0.64(树莓派2017-11-29-raspbian-stretch版本,采用PYTHON VIRTUAL ENVIRONMENT虚拟环境)
    # Home Assistant 0.64安装方法见https://home-assistant.io/docs/installation/raspberry-pi/
    # Home Assistant安装位置/srv/homeassistant,配置文件位置/home/homeassistant/.homeassistant。
    # 官方教程systemd启动建立方法 https://home-assistant.io/docs/autostart/systemd/

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

    [Service]
    Type=simple
    User=%i
    ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

    [Install]
    WantedBy=multi-user.target

    可以使用nano编辑器新建文件hass@homeassistant.service,如下命令,然后复制上面的内容,再按下Ctrl+O,Y,Ctrl+X。

    sudo nano -w /etc/systemd/system/hass@homeassistant.service

    或者使用SCP方式将已创建好的文件放置到/usr/lib/systemd/system/下,使用下面的命令启用开机自动启动

    sudo systemctl --system daemon-reload

    sudo systemctl enable hass@homeassistant

    以后使用下面的命令停止stop或者重新启动restart,查看状态status

    sudo systemctl stop hass@homeassistant

     

  • 相关阅读:
    football statistics
    频繁模式挖掘 Apriori算法 FP-tree
    回首页---用通用底部栏,不用回退键,且多次点击,刷新首页
    对剪切板的失控异常的处理---多半的时间再处理剪切板的失控---冗余操作
    登陆
    搜狗输入法APP的2个剪切板内容获取入口
    实现对屏幕指定内容的操作
    定时删除clientmqueue
    局部优化与整体效果 新增时间>节省时间 权衡利弊
    实时系统的目标
  • 原文地址:https://www.cnblogs.com/arrive/p/9602932.html
Copyright © 2011-2022 走看看