【发布时间】:2016-05-06 09:06:12
【问题描述】:
在 Raspberry Pi 上,我在 /etc/init.d 文件夹中有一个名为“instore”的脚本文件。 我执行命令后
service instore restart
omxplayer 进程应该停止。但这种情况并非如此。脚本的相关部分:
do_start () {
log_daemon_msg "Starting $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
killall -9 omxplayer omxplayer.bin &> /dev/null
log_end_msg $?
}
case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
exit 1
;;
如果我使用命令
killall -9 omxplayer
在终端中,进程总是停止。有谁知道可能是什么问题?
【问题讨论】:
-
你确定
killall被调用了吗? -
我不太确定,但一个月前它起作用了。没有任何软件更新。并且没有任何脚本修改。
-
您还没有提供足够的信息,供我们调试。如果调用 do_stop(),您将在日志文件中看到一行。会发生这种情况吗?
-
killall是您自己添加到脚本中的行吗?另外仅供参考,问题的描述应该放在问题中而不是 cmets 中,这样人们就不必筛选所有 cmets 来解决您的问题。因此,当被要求提供信息时,请考虑编辑您的问题而不是添加其他评论 -
这是大约八个月前我的一位同事制作的脚本。它总是有效,但一个月前发生了一些事情。
标签: linux shell microcontroller xbmc raspberry-pi3