Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-12-2010, 06:49 PM   #1
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:
pkill screen -U 2527
cd /home/bf4/bf2
screen ./
When starting the script manually by
everything works fine. But when I install it with
crontab -e
0 5 * * * sh /home/bf4/
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
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

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

       -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
LQ Newbie
Registered: Sep 2010
Posts: 26

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

wbr RikuXan


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 AM.

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