使用 Raspbian Jessi Wheezy 和 Raspberry Pi2b 在启动时运行脚本 [英] Run Script on Startup with Raspbian Jessi Wheezy and Raspberry Pi2b

查看:56
本文介绍了使用 Raspbian Jessi Wheezy 和 Raspberry Pi2b 在启动时运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多关于这个主题的帖子,但是尽管我处理了很多很多,但我无法让它工作.

I know there are lots of posts on this topic, but depite working through many many many of them I cant get this working.

我有一个带有 raspbian jessie wheezy 的 raspberry pi2b.

I have a raspberry pi2b with raspbian jessie wheezy.

我想在启动时自动运行这个 framebuffer 命令:

I want to run this framebuffer command automatically on startup:

sudo/usr/bin/fbi -T 1 -t 1 -1 -a -noverbose/home/pi/Pictures/*.jpg

我最初编辑了 rc.local 并在其中尝试了每个命令,但在启动时没有任何反应:

I initially edited rc.local and into it I tried each of these commands but nothing happened on startup:

sudo/usr/bin/fbi -T 1 -t 1 -1 -a -noverbose/home/pi/Pictures/*.jpg

sudo fbi -T 1 -t 1 -1 -a -noverbose/home/pi/Pictures/*.jpg

然后我在我的/home/pi/projects/test 文件夹中创建了一个名为 script_auto_run 的脚本,其中包含以下代码:

so then I created a script called script_auto_run in my /home/pi/projects/test folder containing the following code:

#!/bin/bash
# Script to start our application
sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg

进入rc.local我放置

into rc.local I placed

sudo /home/pi/projects/test/script_auto_run

再次启动时没有任何反应

Again nothing happens on startup

然后我在我的 /etc/init.d 文件夹中重新创建了我的 script_auto_run 文件,其内容如下:

So then I re-created my script_auto_run file in my /etc/init.d folder and its contents are as follows:

#!/bin/bash
# /etc/init.d/script_auto_run
### BEGIN INIT INFO
# Provides:          servoblaster
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This service is used to manage a servo
### END INIT INFO
sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg
exit 0

我运行了 sudo chmod +x/etc/init.d/script_auto_run 命令,然后再次将我的 rc.local 编辑为以下行:

I ran the sudo chmod +x /etc/init.d/script_auto_run command and then edited my rc.local yet again to the following line:

sudo /etc/init.d/script_auto_run

<小时>

这些都不起作用.我可以从终端手动运行 rc.local 或 script_auto_run ,没有问题.但是它们不会在启动时自动执行.Raspbian 只是正常启动到 GUI.


None of these are working. I can run rc.local or script_auto_run from the terminal manually and there is no problem. But they are not executing automatically on startup. Raspbian is just booting to the GUI as normal.

推荐答案

我建议按照这个http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/custom-boot-up-screen.它对我有用,而且很容易.希望有帮助

I suggest to follow this http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/custom-boot-up-screen. It works for me and it's easy. Hope it helps

这篇关于使用 Raspbian Jessi Wheezy 和 Raspberry Pi2b 在启动时运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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