Raised This Month: $32 Target: $400
 8% 

[L4D2] Linux : "quit" kills the "screen"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
midnight9
Senior Member
Join Date: Nov 2012
Old 04-13-2017 , 10:06   [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #1

Hello, Im having problems with server auto-restart for L4D2. I've got a plugin that will execute "quit" command in order to restart L4D2 server but the server never comes back online. I use screen to run the servers and i notice that when "quit" is performed it not only kills the L4D2 server but it also kills the Screen. Is there anything i can do to make it stop killing the screen?
midnight9 is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 04-13-2017 , 10:26   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #2

What's your commandline for srcds?
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 04-13-2017 , 11:49   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #3

Quote:
Originally Posted by Sillium View Post
What's your commandline for srcds?
screen -mdS server01 /home/user/L4D2/srcds_run -game left4dead2 -debug -tickrate 100 -maxplayers 12 -ip xxx.xxx.xx.xx -port 27015 +map c5m1_waterfront +exec run01.cfg

Last edited by midnight9; 04-13-2017 at 11:51.
midnight9 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-13-2017 , 12:35   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #4

Maybe this? https://unix.stackexchange.com/quest...ed-script-ends
__________________
WildCard65 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 04-13-2017 , 16:24   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #5

I guess i will have to use auto screen restart script and set a cronjob for checking.
midnight9 is offline
checkster
BANNED
Join Date: Apr 2007
Location: Norway
Old 04-13-2017 , 17:35   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #6

quit wont restart unless you have a proper batch for it, quit, does quit.
checkster is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 04-14-2017 , 01:08   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #7

Quote:
Originally Posted by midnight9 View Post
I guess i will have to use auto screen restart script and set a cronjob for checking.
quit will kill the screen. If you're wanting a restart you should probably use _restart

Or just setup another script that kills specific screens such as:

Code:
screen -x server_name1 -X quit &&
screen -x server_name2 -X quit &&
screen -x server_name3 -X quit &&
screen -x server_name4 -X quit &&
screen -x server_name5 -X quit
Edit - You're probably wanting daily restarts right? I'll post exactly what I use with the hopes it helps you. I started doing this with zero experience and it took over a year for me to stumble upon this.

You don't need a plugin to restart your server, you only need a few scripts and setup some crons.

Script 1 - server 1 command line
Script 2 - server 2 command line
Script 3 - starts all server(s) by executing script 1, script 2, etc
Script 4 - kills specifically named screens

Script 1 (server1.sh)
Code:
#!/bin/bash
screen -dmAS SCREEN1 -t s1 /path/to/server/startup.sh
Script 2 (server2.sh)
Code:
#!/bin/bash
screen -dmAS SCREEN2 -t s1 /path/to/server/startup.sh
Script 3 (start.sh)
Code:
cd /path/to/server1.sh && ./server1.sh &&
cd /path/to/server2.sh && ./server2.sh
Script 4 (killer.sh)
Code:
screen -x SCREEN1 -X quit &&
screen -x SCREEN2 -X quit
If you use those you only need to set a cron to run start.sh and killer.sh at whatever time you want your restarts to happen.
__________________

Last edited by Phaiz; 04-14-2017 at 01:19.
Phaiz is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 04-14-2017 , 01:35   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #8

Quote:
Originally Posted by Phaiz View Post
quit will kill the screen. If you're wanting a restart you should probably use _restart

Or just setup another script that kills specific screens such as:

Code:
 screen -x server_name1 -X quit &&
 screen -x server_name2 -X quit &&
 screen -x server_name3 -X quit &&
 screen -x server_name4 -X quit &&
 screen -x server_name5 -X quit
Edit - You're probably wanting daily restarts right? I'll post exactly what I use with the hopes it helps you. I started doing this with zero experience and it took over a year for me to stumble upon this.

You don't need a plugin to restart your server, you only need a few scripts and setup some crons.

Script 1 - server 1 command line
Script 2 - server 2 command line
Script 3 - starts all server(s) by executing script 1, script 2, etc
Script 4 - kills specifically named screens

Script 1 (server1.sh)
Code:
#!/bin/bash
 screen -dmAS SCREEN1 -t s1 /path/to/server/startup.sh
Script 2 (server2.sh)
Code:
#!/bin/bash
 screen -dmAS SCREEN2 -t s1 /path/to/server/startup.sh
Script 3 (start.sh)
Code:
cd /path/to/server1.sh && ./server1.sh &&
 cd /path/to/server2.sh && ./server2.sh
Script 4 (killer.sh)
Code:
screen -x SCREEN1 -X quit &&
 screen -x SCREEN2 -X quit
If you use those you only need to set a cron to run start.sh and killer.sh at whatever time you want your restarts to happen.
I have tried _restart and it also kill the screen, and yes i want daily restarts. Im using server side plugin to execute quit since the plugin checks for players on the server and it will only execute "quit" when there is no players on the server. Any ways I've made a shell script and got a cronjob to check whenever screen is running and if not the script wil restart screen. The only thing that I havent figured out yet is how to stop servers for maintanace and such, since when i stop them "screen -r server01 -X quit" the auto-restart script will restart them within a minute. I guess i could just remove the cronjob everytime i wanted to stop them but i would like better easier way to do that.
midnight9 is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 04-14-2017 , 11:56   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #9

I never had any of the problems you're describing.
__________________
Phaiz is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 04-18-2017 , 02:00   Re: [L4D2] Linux : "quit" kills the "screen"
Reply With Quote #10

Isn't the wrapper script (srcds_run) only restarting the server when the -autoupdate command is supplied?

./srcds_run -autoupdate -steam_dir /PATH/TO/STEAMCMD/steamcmd/ -steamcmd_script /PATH/TO/UPDATE/SCRIPT/l4d2.steam -game left4dead2 -maxplayers 8 -port 27024 +map c5m1_waterfront +ip xxxx"
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
Reply


Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode