Hi, I am trying to set up a cron job to load up an application on my server every two hours. I have the following code which works successfully from the terminal but does not run from cron even though it is running as the same user and I have even tried giving the user root privalages on the cron job. Below is my bash file "minecraft.sh"

#!/bin/bash/
cd /home/minecraft
java -Xincgc -Xmx2250M -jar craftbukkit-1.0.1-R1.jar

Then in the cron job just like in the terminal I use the following command.

bash /home/minecraft/minecraft.sh

Can somebody please help me solve this as it is annoying the hell out of me as this is a really big problem for me. Anybody know what might be happening? Thanks.

I think I solved it by using the following:

#!/bin/bash/
cd /home/minecraft
screen -dmS minecraft java -Xincgc -Xmx2250M -jar craftbukkit-1.0.1-R1.jar

hope that helps future generations.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.