Code Monkey home page Code Monkey logo

laser_v1's Introduction

sudo pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
sudo pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
要使用 systemd 服务管理器来实现自启动 /home/firefly/laser_v1 下的 main.py, 可以按照以下步骤操作:

创建一个新的 systemd service 文件
(已在文件夹laser_service中)
可以在 /etc/systemd/system 目录下创建一个新的文件,例如 laser.service,并在其中添加以下内容:

[Unit]
Description=My Laser Service

[Service]
ExecStart=/usr/bin/python3 /home/firefly/laser_v1/main.py
Restart=always
User=firefly
Group=firefly
Environment=PATH=/usr/bin:/usr/local/bin
Environment=PYTHONPATH=/home/firefly/laser_v1

[Install]
WantedBy=multi-user.target

这个文件定义了一个新的服务,当系统启动时, 它会运行 /home/firefly/laser_v1/main.py 这个 Python 脚本。 Restart=always 表示如果这个服务因任何原因停止,系统会自动重新启动它。

启动服务。你可以使用以下命令来启动你刚刚创建的服务:

sudo systemctl start laser.service

设置服务为开机自启动。如果你想让这个服务在系统启动时自动运行,你可以使用以下命令:

sudo systemctl enable laser.service

laser_v1's People

Contributors

l-jac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.