Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:05:34+00:00 2026-06-15T07:05:34+00:00

I’m having problem with crontab when I’m running a script. My sudo crontab -e

  • 0

I’m having problem with crontab when I’m running a 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 the start.sh looks like this:

#!/bin/sh
screen java -d64 -Xincgc -Xmx2048M -jar craftbukkit.jar nogui

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, either using sudo or not

./start.sh

But it wont 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 isn’t it working?
And since my script run without using sudo, I don’t necessarily need to put it in sudo crontab?

( and I’m using Ubuntu 12.10 )

Thanks in advance,
Philip


Answer to twalberg’s response

1. Changed owner on craftbukkit to root, to see if that fixed the problem.

-rw-r--r-- 1 root root 12084211 Nov 21 02:14 craftbukkit.jar

and also added an explicit cd in my start.sh script as such:

#!/bin/sh
cd /opt/mcserver/
screen java -d64 -Xincgc -Xmx2048M -jar craftbukkit.jar nogui

2. I’m not quite sure what you mean here. Should I use the following path in my start.sh file when i start java?
(output from which java)

/usr/bin/java

3. When my server closes, screen is terminated. Is it a good idea to start screen in “detached mode” anyway?

Still got the same “Permission denied” error.


Problem solved!
By using the proper flag on screen, as below, it is now working as it should!

screen -d -m java -d64 -Xincgc -Xmx2048M -jar craftbukkit.jar nogui

Thanks a lot to those who answered, and especially twalberg!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:05:36+00:00Added an answer on June 15, 2026 at 7:05 am

    Here are some things to check:

    1. root obviously has read/execute permissions on start.sh, but what are the permissions on craftbukkit.jar – can root read it? You may also want to add an explicit cd /path/to/where/craftbukkit.jar/is in your start.sh script.
    2. Is java in root‘s default path within cron? Note that this path is not necessarily the same as the one that you get via sudo, su or directly logging in as root – it’s typically much more restricted. Use full path names to both java and craftbukkit.jar to work around that.
    3. Since screen will not start with a terminal available, you may need screen -d -m ... instead. Hopefully, you intend to eventually attach to each screen instance and terminate it later, or you have arranged for it to terminate automatically when the script is done…
    4. The /var/log/syslog entry shows that cron did in fact execute the script, so it must have failed for one of the above reasons (or something else I haven’t noticed yet)
    5. The other errors from grep are simply due to the fact your non-root user does not have permission to read those specific files (this is normal, and a good thing).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I am currently running into a problem where an element is coming back from
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.