Create a Screen session with a bash script using crontab

Solution 1:

Start screen in detached mode, and make it run your command inside it:

screen -d -m -S bukkit bash -c 'cd $HOME/server && java -jar bukkit.jar'

You might want to create a dedicated script bukkit.sh:

#!/bin/bash -e
cd ~/server
java -jar bukkit.jar

So that if the script becomes more complex you don't have to write a long line for screen, and so the screen command can stay the same, simply:

screen -d -m -S bukkit path/to/bukkit.sh

Solution 2:

You should update-rc.d as follows to turn on service on boot:

# update-rc.d cron defaults