Server rentals :: NFOservers.com

Forums

All times are UTC - 8 hours



Author Message
PostPosted: Wed Aug 01, 2012 11:03 am 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
Hey guys!

I have this self-made script and it does work well and performs all actions, if it is started manually, however, it does not perform the action from line 81, if it is automatically started from cron.

I don't understand, why.
Any thoughts?

http://pastie.org/private/9duxtwkcqwgnrgh2cn3dng


Thank you! :wink:


Top
 Profile  
 
PostPosted: Wed Aug 01, 2012 11:18 am 
Offline
Founder
Founder
User avatar

Joined: Thu Apr 18, 2002 11:04 pm
Posts: 9232
Location: Seattle
Does it work outside cron?

Have you tried using the full path to Java?


Top
 Profile  
 
PostPosted: Wed Aug 01, 2012 11:28 am 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
Yes, script works and starts the server, when initiated manually.
How do I add java location?


Top
 Profile  
 
PostPosted: Wed Aug 01, 2012 11:29 am 
Offline
Founder
Founder
User avatar

Joined: Thu Apr 18, 2002 11:04 pm
Posts: 9232
Location: Seattle
"which java" will show you where the executable is located.


Top
 Profile  
 
PostPosted: Wed Aug 01, 2012 12:07 pm 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
it says /usr/bin/java

Where do I put it? Should I add -cp /usr/bin/java ?


Top
 Profile  
 
PostPosted: Wed Aug 01, 2012 12:14 pm 
Offline
Founder
Founder
User avatar

Joined: Thu Apr 18, 2002 11:04 pm
Posts: 9232
Location: Seattle
I suggest that you try replacing "java" with "/usr/bin/java".


Top
 Profile  
 
PostPosted: Thu Aug 02, 2012 10:46 am 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
Ok, it didn't helped. java app still does not want to start from script, via cron job.


Top
 Profile  
 
PostPosted: Thu Aug 02, 2012 11:41 am 
Offline
Founder
Founder
User avatar

Joined: Thu Apr 18, 2002 11:04 pm
Posts: 9232
Location: Seattle
I recommend that you do some tests with simpler commands to try to narrow down where the mistake is. Replace the java line with having it echo something, for instance, or remove the "nice" bit. Make sure that the command runs on its own when it's not started through cron. Remove the unnecessary quotation marks from around "mc".


Top
 Profile  
 
PostPosted: Fri Aug 03, 2012 2:54 am 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
I removed quotes, I removed nice. Nothing helps. Maybe, problem is with sudo?
What else can I do?

Thank you for helping me :!:


Top
 Profile  
 
PostPosted: Fri Aug 03, 2012 10:53 am 
Offline
A regular
A regular

Joined: Sat Apr 28, 2012 6:24 pm
Posts: 49
java runs from that script, if it is not initiated by cron.
Is cron a different user with different permissions or something?


Top
 Profile  
 
PostPosted: Fri Aug 03, 2012 11:28 am 
Offline
Founder
Founder
User avatar

Joined: Thu Apr 18, 2002 11:04 pm
Posts: 9232
Location: Seattle
Cron runs as the same user.

You'll need to keep troubleshooting and trying different things -- that's what I would do. Try running a bash script instead. Try running "echo". Keep paring things down until you find what about that line is causing the problem, and then focus on working around that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
It is currently Tue May 21, 2013 3:08 am
Powered by phpBB® Forum Software © phpBB Group