title: Screen not starting from rc.local
body: <p>I have a problem where I am unable to start a screen session at boot using the rc.local file. The specific screen I am starting is for a spigot minecraft server.</p>
  
  <p>This is my rc.local file:</p>
  
  <pre><code>#!/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
  </code></pre>
  
  <p>This is the startspigot.sh script (with chmod u+x):</p>
  
  <pre><code>#!/bin/bash
  
  cd /home/spigot1_12
  
  boot=$(date)
  
  echo "Starting spigot server in screen \"minecraft\" @  $boot " &gt;&gt; /home/pi/Documents/minecraftlog
  
  
  screen -S minecraft java -Xms512M -Xmx1008M -jar /home/spigot1_12/spigot-1.12.jar nogui
  </code></pre>
  
  <p>The minecraftlog file does update at each boot, so the script is run.</p>
  
  <p>When I run the command "sudo sh startspigot.sh", everything works perfectly. The screen is started and the minecraftlog file is updated. I can find the screen again with "sudo screen -ls"</p>
  
  <p>At boot, however, both "sudo screen -ls" and "screen -ls" return no sockets.</p>
  
  <p>What can be causing this? The only two users are "pi" and root.</p>
  
  <p>Thanks in advance!</p>