Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 屏幕未从rc.local启动_Linux_Bash_Gnu Screen_Rc - Fatal编程技术网

Linux 屏幕未从rc.local启动

Linux 屏幕未从rc.local启动,linux,bash,gnu-screen,rc,Linux,Bash,Gnu Screen,Rc,我有一个问题,无法使用rc.local文件在启动时启动屏幕会话。我启动的特定屏幕是一个插口minecraft服务器 这是我的rc.local文件: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error.

我有一个问题,无法使用rc.local文件在启动时启动屏幕会话。我启动的特定屏幕是一个插口minecraft服务器

这是我的rc.local文件:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/home/pi/Documents/bootlog.sh
/home/spigot1_12/startspigot.sh
exit 0
这是startspigot.sh脚本(带有chmod u+x):

minecraftlog文件在每次启动时都会更新,因此脚本会运行

当我运行命令“sudoshstartspigot.sh”时,一切都运行得很好。屏幕启动,minecraftlog文件更新。我可以用“sudo screen-ls”再次找到屏幕

然而,在启动时,“sudo screen-ls”和“screen-ls”都不返回套接字

这是什么原因造成的?仅有的两个用户是“pi”和root


提前谢谢

在分离模式下运行屏幕(当您没有活动终端时,如在rc.local或crontab中):

screen-dm-S

-d-m启动屏幕处于“分离”模式

-S创建新会话时,此选项可用于为会话指定有意义的名称


以当前用户(rc.local=root)的身份在新分离的屏幕中启动脚本:

屏幕-dmS
,示例:

screen-dmS屏幕名bash/home/user/run.sh


以用户身份从rc.local启动脚本:

runuser-l user-c'屏幕-dmS屏幕名bash/home/user/run.sh'


Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参见帮助中心中的。也许或者会是一个更好的提问的地方。
#!/bin/bash

cd /home/spigot1_12

boot=$(date)

echo "Starting spigot server in screen \"minecraft\" @  $boot " >> /home/pi/Documents/minecraftlog


screen -S minecraft java -Xms512M -Xmx1008M -jar /home/spigot1_12/spigot-1.12.jar nogui