LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-12-2010, 06:49 PM   #1
RikuXan
LQ Newbie
 
Registered: Sep 2010
Posts: 26

Rep: Reputation: 0
Screen doesn't work in Cronjob-SH


Hey guys,
i wanted to ask you for help in setting up a cronjob, that restarts a gameserver.
By now I made a script that kills the screen of the server and then restarts it.
Looks like this:
Code:
pkill screen -U 2527
cd /home/bf4/bf2
screen ./start.sh
When starting the script manually by
Code:
sh restart.sh
everything works fine. But when I install it with
Code:
crontab -e
and
Code:
0 5 * * * sh /home/bf4/restart.sh
it only kills the server but won't restart it. Somehow the screen command is ignored or fails.

I hope you can help me with this issue.

wbr RikuXan
 
Old 09-12-2010, 07:32 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Start the screen in detached mode.

Code:
       -d -m   Start  screen in "detached" mode. This creates a new session but doesn’t attach to
               it. This is useful for system startup scripts.
 
Old 09-12-2010, 07:44 PM   #3
RikuXan
LQ Newbie
 
Registered: Sep 2010
Posts: 26

Original Poster
Rep: Reputation: 0
Works like a charm.
Thank you so much

wbr RikuXan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Cant get my cronjob to work kraffslol Linux - Software 5 12-27-2009 11:58 PM
tar in cronjob does not work 100% jeep88 Linux - Newbie 1 02-19-2009 06:55 AM
Cronjob does not work niner710 Linux - Newbie 11 05-07-2008 04:45 AM
'lsof' doesn't work in cronjob BlackHatRob Linux - Software 2 03-07-2008 05:03 PM
Cronjob won`t work in /var nodger Linux - Software 3 11-02-2004 07:44 PM

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

All times are GMT -5. The time now is 08:54 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration