AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Source Servers (SRCDS) (https://forums.alliedmods.net/forumdisplay.php?f=130)
-   -   [L4D2] Linux : "quit" kills the "screen" (https://forums.alliedmods.net/showthread.php?t=296143)

midnight9 04-13-2017 10:06

[L4D2] Linux : "quit" kills the "screen"
 
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?

Sillium 04-13-2017 10:26

Re: [L4D2] Linux : "quit" kills the "screen"
 
What's your commandline for srcds?

midnight9 04-13-2017 11:49

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

Originally Posted by Sillium (Post 2511792)
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

WildCard65 04-13-2017 12:35

Re: [L4D2] Linux : "quit" kills the "screen"
 
Maybe this? https://unix.stackexchange.com/quest...ed-script-ends

midnight9 04-13-2017 16:24

Re: [L4D2] Linux : "quit" kills the "screen"
 
I guess i will have to use auto screen restart script and set a cronjob for checking.

checkster 04-13-2017 17:35

Re: [L4D2] Linux : "quit" kills the "screen"
 
quit wont restart unless you have a proper batch for it, quit, does quit.

Phaiz 04-14-2017 01:08

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

Originally Posted by midnight9 (Post 2511899)
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.

midnight9 04-14-2017 01:35

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

Originally Posted by Phaiz (Post 2512000)
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.

Phaiz 04-14-2017 11:56

Re: [L4D2] Linux : "quit" kills the "screen"
 
I never had any of the problems you're describing.

Sillium 04-18-2017 02:00

Re: [L4D2] Linux : "quit" kills the "screen"
 
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"


All times are GMT -4. The time now is 05:09.

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