使用选项 -D -R SessionName 时的屏幕消息 "Must be connected to a terminal"

Screen message "Must be connected to a terminal" when using option -D -R SessionName

我在 bash 中有脚本,用于检查 mp4 文件,如果找到多个文件,它就会开始一个一个地播放。

当我通过 ssh 登录时,脚本从命令行运行。

但是当我重新启动 rpi 时,它不会自动启动 rc.local 说

"Must be connected to a terminal"

这是脚本的一部分

    if [ "$count_dir_video" -gt "1"  ] ;then
 53 
 54                 # make background black to hide wallpaper between videos
 55                 DISPLAY=:0 screen -dmS "black_background" feh -FxYqZ /opt/scripts/black_background.jpg
 56                 echo "przed sleep"
 57                 #screen -dmS "" sleep 5
 58                 echo "po sleep"
 59 
 60                         while :
 61                         do
 62                                 for entry in $root_dir_video
 63                                 do
 64 
 65                                 # multiple files
 66                                 echo "przed omx"
 67                                 screen -D -R "" omxplayer -o hdmi -p -b --no-osd --vol 100 "$entry" >> /var/log/sds.log
 68                                 echo "po omx"
 69                                 done
 70                         done
 71                 else
 72 
 73                         # single file
 74 
 75                         screen -dmS "" omxplayer -o hdmi -p -b --loop --no-osd --vol 100 "$root_dir_video"
 76                 fi

问题在第 67 行,我无法让它工作。

我尝试了其他参数屏幕组合,但总是一样。

想法是它将在一次命名的屏幕会话中启动每个条目。

人工屏幕

   -D -R   Attach here and now. In detail this means: If a session is run‐
           ning, then reattach. If necessary detach  and  logout  remotely
           first.   If  it  was not running create it and notify the user.
           This is the author's favorite.

使用小写 -d-m