简体   繁体   English

Arch Linux启动应用程序(脚本)Raspberry Pi

[英]Arch linux startup application (script) Raspberry Pi

I want to use an RPi running Arch Linux to power an embedded device and I therefore need the RPi to launch a (Mono C#) application the moment after it has finished booting without the user having to do anything. 我想使用运行Arch Linux的RPi为嵌入式设备供电,因此我需要RPi在启动完成后立即启动(Mono C#)应用程序,而无需用户执行任何操作。 I have seen tutorials of how to do this on Raspbian but not for Arch. 我看过有关如何在Raspbian上执行此操作的教程,但没有关于Arch的教程。 Can anyone help please? 有人可以帮忙吗?

Systemd should do the trick. Systemd应该可以解决问题。 Create a service file for systemd: 为systemd创建服务文件:

vim /usr/lib/systemd/system/*yourApp*.service

The service file will need to contain at a minimum the following: 该服务文件至少需要包含以下内容:

[Unit]
Description=My C# application

[Service]
ExecStart=<fully qualified path to your C# application>

[Install]
WantedBy=multi-user.target

You should then be able start the service using 然后,您应该可以使用启动服务

systemctl start yourApp

you can quickly see if it worked or if there are any errors using 您可以使用它快速查看它是否有效或是否有任何错误

systemctl status yourApp

Once your happy that its working enable the service to start automatically using: 一旦对它的运行感到满意,就可以使用以下命令自动启动该服务:

systemctl enable yourApp

use the link to the arch wiki provided by dna to learn more about more options for systemd files arch wiki 使用该链接通过DNA所提供的拱维基了解更多的选项systemd文件拱维基

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM