I have a problem with crontab when I run the script.
My sudo crontab -e looks like this:
05 00 * * * /opt/mcserver/backup.sh 10 00 * * * /opt/mcserver/suspend.sh 05 08 * * * /sbin/shutdown -r +1 11 11 * * * /opt/mcserver/start.sh <--- This isn't working
And start.sh looks like this:
and have these permissions (ls -l output)
-rwxr-xr-x 1 eve eve 72 Nov 24 14:17 start.sh
I can run the command from the terminal using sudo or not
./start.sh
But it does not start with crontab. If i do
grep -iR "start.sh" /var/log
I get the following output
/var/log/syslog:Nov 27 11:11:01 eve-desk CRON[5204]: (root) CMD (eve /opt/mcserver/start.sh) grep: /var/log/btmp: Permission denied grep: /var/log/lightdm/x-0-greeter.log: Permission denied grep: /var/log/lightdm/lightdm.log: Permission denied grep: /var/log/lightdm/x-0.log: Permission denied
So my question is: why doesn't it work? And since my script works without using sudo, do I have to enter it in sudo crontab?
(and I'm using Ubuntu 12.10)
Thanks in advance Philip
<h / "> Reply to twalberg answer
1. Owner changed to craftbukkit for root to make sure the problem is fixed.
-rw-r--r-- 1 root root 12084211 Nov 21 02:14 craftbukkit.jar
and also added an explicit cd to my start.sh script as such:
#!/bin/sh cd /opt/mcserver/ screen java -d64 -Xincgc -Xmx2048M -jar craftbukkit.jar nogui
2. I do not quite understand what you mean here. Should I use the following path in my start.sh file when java starts? (output from which java)
/usr/bin/java
3. When my server closes, the screen ends. In any case, is it nice to run the screen in "off mode"?
I still got the same "Failure Resolution" error.
The problem is solved ! Using the appropriate flag on the screen, as shown below, it now works as it should!
screen -d -m java -d64 -Xincgc -Xmx2048M -jar craftbukkit.jar nogui
Many thanks to those who responded, and especially twalberg!