Service InitV";服务<;xxx>;“开始”;无所事事

Service InitV";服务<;xxx>;“开始”;无所事事,service,crontab,init,autostart,init.d,Service,Crontab,Init,Autostart,Init.d,我正在Raspberry Pi rev2上运行Raspbian GNU/Linux 8(jessie)。我编写了一个python应用程序,在后台运行,收集一些数据。应用程序本身运行良好。但我需要让它在开机时运行。 我随后准备了一个有效的/etc/init.d/。。。剧本看起来像这样: #! /bin/sh # /etc/init.d/templogger ### BEGIN INIT INFO # Provides: templogger # Required-Start:

我正在Raspberry Pi rev2上运行Raspbian GNU/Linux 8(jessie)。我编写了一个python应用程序,在后台运行,收集一些数据。应用程序本身运行良好。但我需要让它在开机时运行。 我随后准备了一个有效的/etc/init.d/。。。剧本看起来像这样:

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

### BEGIN INIT INFO
# Provides:          templogger
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting templogger"
    # run application you want to start
    /home/pi/templogger/templogger.py &
    ;;
  stop)
    echo "Stopping templogger"
    # kill application you want to stop
    killall -15 templogger.py  &
    ;;
  *)
    echo "Usage: /etc/init.d/templogger {start|stop}"
    exit 1
    ;;
esac

exit 0
sudo /etc/init.d/templogger start
当我运行时,请尝试像这样“启动”服务:

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

### BEGIN INIT INFO
# Provides:          templogger
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting templogger"
    # run application you want to start
    /home/pi/templogger/templogger.py &
    ;;
  stop)
    echo "Stopping templogger"
    # kill application you want to stop
    killall -15 templogger.py  &
    ;;
  *)
    echo "Usage: /etc/init.d/templogger {start|stop}"
    exit 1
    ;;
esac

exit 0
sudo /etc/init.d/templogger start
。。。它按预期工作-服务确实正常运行,因此我假设init.d脚本可以运行我的应用程序-没有权限问题。当我尝试“停止”服务时:

sudo /etc/init.d/templogger stop
。。。它停得很好

根据的下一步是“注册”要在启动时运行的脚本:

sudo update-rc.d templogger defaults
此命令不产生任何输出。但是,当我检查
/etc/rcX.d/
时,有一些符号链接应该是:
lrwxrwx 1根根20 lut 15 21:27 S03templogger->../init.d/templogger
当我

sudo更新rc.d templogger删除

。。。符号链接消失了。所以我猜“更新rc”正在做它的工作。 问题是当我试图通过“服务”界面运行它时:

sudo服务模板启动

。。。什么也没发生。应用程序未根据其内部日志启动,也没有“服务”命令的任何输出。此外,我希望该应用程序在启动时运行,但事实并非如此。 我搜索了与服务启动/停止界面相关的帖子,但我只找到了与人们难以运行的特定服务相关的帖子,我没有找到类似的案例。我也考虑过换成暴发户,但是。。。不,我也试着把它作为
@reboot/home/pi/templogger/templogger.py&
放到crontab中,但这种方法也不起作用。
我错过了什么?

这是一个visual basic脚本?哪个.bin可以运行srcript
python/home/pi/templogger/templogger.py&
和一点
如何保持主应用程序的活力?
这是一个带有shebang语句的python脚本
#/usr/bin/python3.4
。主应用程序调用2个线程(一个从传感器轮询数据,另一个将此数据收集到sqlite)。主应用程序等待线程结束,这是无限的,或者直到有SIGTERM或SIGINT。然后线程结束其循环和主出口。我可以看到应用程序何时运行-sqlite db中有一个数据流。这是一个visual basic脚本?哪个.bin可以运行srcript
python/home/pi/templogger/templogger.py&
和一点
如何保持主应用程序的活力?
这是一个带有shebang语句的python脚本
#/usr/bin/python3.4
。主应用程序调用2个线程(一个从传感器轮询数据,另一个将此数据收集到sqlite)。主应用程序等待线程结束,这是无限的,或者直到有SIGTERM或SIGINT。然后线程结束其循环和主出口。我可以看到应用程序何时运行-sqlite db中有数据流。