我将一个RFID模块附加到我的beaglebone上,并使用python代码读取ID标签。现在,我想让我的python代码在没有任何命令的情况下登录到我的beaglebone时直接在后台运行。就像在windows的启动程序中添加一个程序一样。当你登录到你的windows帐户时,这些程序会立即启动。你知道如何做到这一点吗?
问候
发布于 2012-08-14 09:09:09
在/lib/systemd/system/ (在我的示例中是rfidreader.service)中创建一个新文件,内容如下:
[Unit]
Description=Start Python RFID reader
[Service]
WorkingDirectory=/...Python script path.../
ExecStart=/usr/bin/python rfidreader.py
KillMode=process
[Install]
WantedBy=multi-user.target然后执行以下命令安装服务:
systemctl enable rfidreader.service要启动该服务,您可以重新启动或执行:
systemctl start rfidreader.service要检查服务是否正在运行并从脚本中获取最新输出:
systemctl status rfidreader.service发布于 2012-06-25 18:02:37
看看nodejs应用程序是如何在主板的3000端口上运行的,你可以用同样的方式实现你的模块。我认为这是初始化过程的一部分。
http://www.softprayog.in/tutorials/starting-linux-services-with-init-scripts http://www.linuxquestions.org/questions/linux-general-1/how-do-i-automatically-start-a-program-at-start-up-102154/
https://stackoverflow.com/questions/11152657
复制相似问题