LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2014, 03:05 PM   #16
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142

Something is not right and sudo/root is not the answer. My guess is that cron's @reboot directive is running too early in the boot process before /var/run/screen has been prepared.

See:
https://bugs.launchpad.net/ubuntu/+s...en/+bug/574773

edit: lol - we found the same bug report at the same time

As a test, you could try putting a delay in there, something like
Code:
@reboot wait 60; sh /home/steve/craftbukkit.sh > /home/steve/craftbukkit.out 2>&1
If it works, you know that's the problem.

Last edited by suicidaleggroll; 04-28-2014 at 03:07 PM.
 
Old 04-28-2014, 03:09 PM   #17
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
If that works then thats the answer!...I'll try it!
 
Old 04-28-2014, 03:13 PM   #18
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Sorry, typo, that should have been sleep, not wait (getting my delay routines mixed up)
Code:
@reboot sleep 60; sh /home/steve/craftbukkit.sh > /home/steve/craftbukkit.out 2>&1
This will pause for a minute before running the script. So make sure you wait ample time before checking if the screen is there.
 
Old 04-28-2014, 03:14 PM   #19
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by suicidaleggroll View Post
Something is not right and sudo/root is not the answer. My guess is that cron's @reboot directive is running too early in the boot process before /var/run/screen has been prepared.

See:
https://bugs.launchpad.net/ubuntu/+s...en/+bug/574773

edit: lol - we found the same bug report at the same time

As a test, you could try putting a delay in there, something like
Code:
@reboot wait 60; sh /home/steve/craftbukkit.sh > /home/steve/craftbukkit.out 2>&1
If it works, you know that's the problem.
should be sleep 60 ? i dont have much experience with screen but i'm guessing it shouldnt/cant be used without a proper login ?

Last edited by schneidz; 04-28-2014 at 03:17 PM.
 
Old 04-28-2014, 03:26 PM   #20
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Wait a second.....The script file is the one creating the screen and no, wait 60 didn't work I'll try sleep.
 
Old 04-28-2014, 03:28 PM   #21
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by schneidz View Post
i dont have much experience with screen but i'm guessing it shouldnt/cant be used without a proper login ?
You may be right, I don't have a lot of experience with screen either.
 
Old 04-28-2014, 03:35 PM   #22
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Thumbs up

@Sucide Have some faith...It worked perfectly!
Final edit and logs for anyone looking at same solution:

crontab -e
Code:
@reboot sleep 60; bash craftbukkit.sh >> /home/steve/craftbukkit.out 2>&1
Script file in my home directory:
Code:
#!/bin/bash
 BINDIR=$(dirname "$(readlink -fn "$0")")
 cd "$BINDIR"
 cd /home/steve/craftbukkit/
 screen -dmS craftbukkit java -server -Xmx5120M -Xms5120M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+AggressiveOpts -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -Xnoclassgc -XX:UseSSE=3 -XX:LargePageSizeInBytes=4m -jar craftbukkit.jar -o true
Then everytime the computer gets rebooted due to a power failure, your gameserver will restart automatically!

...or you could go buy a $5,000 UPS

Last edited by EODSteven; 04-28-2014 at 04:42 PM. Reason: appended output to log to keep an ongoing log
 
  


Reply

Tags
crontab



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script is not running in Crontab Deepesh_tr Linux - Newbie 8 09-02-2012 07:43 PM
Crontab not running script j8177e5 Linux - Newbie 2 12-21-2010 08:54 AM
[SOLVED] Crontab Script Not Running th1bill Ubuntu 4 12-10-2010 03:49 PM
crontab not running script sunlinux Linux - Newbie 5 05-18-2010 06:21 AM
Running a script with crontab. glore2002 Slackware 3 06-05-2008 08:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration