如何在Debian中启动时运行程序 [英] How to run a program on startup in Debian

查看:610
本文介绍了如何在Debian中启动时运行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行在Raberry Pi 2上启动时创建的程序。该程序正在运行Debian(Jessie),但似乎无法正常运行。我尝试按照该指南进行操作: Debian:在StartUp上运行脚本并创建系统链接,但似乎没有任何效果。当我不在启动时运行该程序时,它将运行。这是代码:

I am attempting to run a program that I made on startup on my Raberry Pi 2. It is running Debian (Jessie) but it doesn't seem to work. I tried following this guide: Debian: Running Scripts on StartUp and creating a system link but nothing seems to be working. The program works when I run it not on startup. Here's the code:

#!/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...

最后一条命令有效,所以我没有包括整行,因为它是长行。

The last command works so I didn't include the whole line as it is a long line.

任何帮助都是

推荐答案

为该程序创建一个桌面条目并将其放在〜/ .config /中自动启动

Create a desktop entry for the program and place it in ~/.config/autostart

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

As an example that starts Safe Eyes program placing it as ~/.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;

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

[Optional] Set the proper permission.

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

这篇关于如何在Debian中启动时运行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆