linux - 如何在 Debian 中启动时运行程序

标签 linux raspberry-pi debian startup

我正在尝试运行我在 Raberry Pi 2 上启动时编写的程序。它正在运行 Debian (Jessie),但它似乎不起作用。我尝试遵循本指南:Debian: Running Scripts on StartUp并创建一个系统链接,但似乎没有任何作用。该程序在我运行时而不是在启动时运行。代码如下:

#!/bin/sh
#/etc/init.d/StartGRIP.sh
#

### BEGIN INIT INFO
# Provides:            StartGRIP.sh
# Required-Start:      $local_fs $network
# Required-Stop:       $local_fs
# Default-Start:       2 3 4 5
# Default-Stop:        0 1 6
# Short-Description:   Starts GRIP Pipeline
# Description:         During startup, runs below command and starts GRIP
### END INIT INFO
# Start processing
env LD_LIBRARY_PATH=/home/pi/vision/grip:LD_LIBRARY_PATH java -jar...

最后一个命令有效,因此我没有包含整行,因为它很长。

非常感谢任何帮助!

最佳答案

为该程序创建一个桌面条目并将其放置在~/.config/autostart

作为启动 Safe Eyes 程序的示例,将其放置为 ~/.config/autostart/safeeyes.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Safe Eyes
Comment=Protect your eyes from eye strain
Exec=safeeyes
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
Categories=Utility;

[可选]设置适当的权限。

  sudo chmod 644 /.config/autostart/[program-name].desktop

关于linux - 如何在 Debian 中启动时运行程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35530062/

相关文章:

linux - 全新安装后无法识别 Eclipse Workspace

python - 在windows上使用linux cookies时的解密问题

linux - bash , tar "cannot stat no such file or directory"

linux - 我们如何在Qt工具包(Qt)应用程序中读取安装(Raspberry pi)usb中的所有mp3文件

c++ - raspbian (raspberry pi 3) 连接到数据库 (mysql/mariadb)

c# - RS485为什么会返回发送的数据?

python - 如何在从源 Python 编译的上安装 Pip

ubuntu - 我如何使用 dpkg --build 制作带有 dsc 的 debian 软件包?

apache2 - 使用 WSGI 和 Apache 设置 Roundup

c++ - 共享对象中命名不兼容的符号 - 在哪里查找问题