【发布时间】:2017-06-23 02:31:26
【问题描述】:
我在 raspbian jessie - pixel 上的 /etc/init.d 中创建了一个 bash 脚本。脚本如下:
auto_announce
#! /bin/bash
#/etc/init.d/auto_announce
### BEGIN INIT INFO
# Provides: auto_announce
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
amixer cset numid=3 1
(cd /home/pi/vehicle_anouncement_system/ && forever start app.js) && (python /home/pi/vehicle_anouncement_system/simulation.py)
我需要做的是:
在 app.js 上永远开始:
forever start app.jsforever启动后,运行python脚本simulation.py:
python simulation.py
问题是forever启动成功,但是python脚本没有运行。
当我使用 ./auto_announce 在终端中运行上述脚本时,该脚本运行良好。但它在系统启动时不能完美运行。
我错过了什么?有没有办法记录上述脚本的输出以找出导致问题的原因?
谢谢。
【问题讨论】:
-
是的,有办法记录。例如。通过在脚本中添加一些重定向。但是,如果您使用的是 systemd,我建议您改为编写服务,并且您应该免费获得很多东西,例如记录。
标签: bash raspberry-pi sysv