noice Posted September 6, 2015 Share Posted September 6, 2015 At this time, more than half of DST dedicated servers are out of date! (364 servers out of 693).That's a lot given the last game update was already 5 days ago!Statistics from: DST Server list and version update from SteamDB Server admins, don't waste your time in managing your DST server for game updates and mod updates, this script will do it for you! Features: v1.3Check for game and mod updates periodicallyGraceful shutdown: If no user is playing, shutdown & update immediatelyForced shutdown: If users are playing, wait until 3:00 AM - 6:00 AM local server time to do the shutdown & update.Announces: If users are playing, they are informed every 30 minutes about the next shutdown time (configurable).Auto-restart the game after an update, or if the game screen suddenly dies.Full support for multiple servers on the same machine (configurable paths).Caves support. Changelog & Update procedure:v1.1: Forced shutdown can be disabledv1.2: Full support for multiple servers, new screen management.To update, just overwrite the script, update the config (don't copy/paste! DST_conf_dirname is a directory name, not a full path) and restart the updater (not in a screen, it will launch the screen by itself). You don't need to stop your game server.No change in Graceful shutdown mod.v1.3: Added support for CAVES! To upgrade, overwrite mod graceful shutdown files and auto_update_dst.sh, edit auto_update_dst.sh config settings, shutdown your server (c_shutdown() from console) and run the script. To use cave, create and test your master/slave servers as per official instructions, then check the config setting example. Screenshot: Pre-requisites:LinuxAn aleady installed and working DST dedicated serverscreen, diff, grep, steamcmd, bash500MB of disk drive to store a permanent updated copy of the game, or 1GB if you use cavesbeta master/slave servers and a regular serversNo manual modification of the source game files (ie. game path, not conf path): update will overwrite it (there's an option to avoid this). Mods are OK. Install: 0. Make a backup of your game folder if you modified some game files (except dedicated_server_mods_setup.lua or modsettings.lua). That's safer. 1. Install dependencies if you don't already have them:sudo apt-get install screen diffutils grep2. Download the zip file from this thread and extract the "modgracefulshutdown" folder in your game "mod" folder. Do it for each server that will be managed by this script.Download from Klei forum (logged in): DST-auto-updater-v1_3.zipOr download from Dropbox (anonymous): DST-auto-updater-v1_3.zip 3. Enable the mod:gedit "/home/steam/.klei/DoNotStarveTogether/modoverrides.lua"Or whatever your preferred text editor, like pico or vim.And add the mod:return {-- Your other mods...["modgracefulshutdown"] = { enabled = true }, -- Graceful Shutdown-- Your other mods...}Repeat this operation for each server that will be managed by this script. 4. From the zip file of this thread, extract auto_update_dst.sh it in your home folder (or whatever). 5. Edit auto_update_dst.sh and replace these variables values by your own:DST_game_path[1]="/home/${USER}/steamapps/DST"DST_conf_dirname[1]="DoNotStarveTogether" # Server configuration directory name located in /home/${USER}/.klei/DST_screen_name[1]="DST"DST_allow_forced_shutdown[1]=trueDST_game_beta[1]="public" # "public" for the production game, or "cavesbeta" for caves master&slave serverssteamcmd_path="/home/${USER}/steamcmd"Your game screen name must not contain spaces, should use use only alphanumeric characters but mostly everything will work. If your server is already running, check its screen name with screen -lsFor caves, first deploy and test your master/slaves servers as per official instructions, then reference your 2 servers as per example (see commented lines of server n°2 and 3). 6. Make the script executablesu - USERWITHROOTRIGHTSsudo chmod 775 /home/steam/auto_update_dst.shexitRun: 1. Stop your existing DST server -OR- be sure you correctly configured the variable "DST_screen_name" to match your current server screen name (if you followed the documentation, it should be "DST" or "DST Server"). You can check your startup script code, or type "screen -ls" to list your current screen names. 2. Finally, run:./auto_update_dst.shOR run auto-update in a screen if you want. Screen is now automatically created.Multi-server and caves:If you have multiple servers: run, for server number 2: ./auto_update_dst.sh 2If you have cave master/slave servers: reference both servers in the config (check the example), but launch only one updater script (with the master or slave server number, whatever). That's it. Now, relax and enjoy The game screen is independant:You can start the auto-updater script, stop it, restart it... your game will continue to run! Your feedback is appreciated! FAQ: Q. How can I test that it works?A. If you're patient: in the log-updater.txt in the server config folder.If you want to check now: edit the number in /home/${USER}/steamapps/DST/version.txt and see what happens.You can even skip the waiting cycle by running in parrallel ./auto_update_dst.sh check, but you should Ctrl+C immediately after the first server has rebooted, to avoid booting the second cave server before all mods are downloaded. Q. How do I configure/enable my server mods?A. Use "dedicated_server_mods_setup.MASTER.lua" (in game mod dir) + "modoverrides.lua" (in conf dir)The master files are created at first start from the existing files (it's just a copy). Q. Does it use a lot of bandwidth?A. No, except at first launch when the game is download to temp dir. You can accelerate the first launch by copying your game folder to a folder called "branch_public" (or "branch_cavesbeta") in your temp dir and then launching../auto_update_dst.sh rebuildQ. How does it work?A. Outdated mod info comes from the game itself that periodically check for outdated mod (cf. mod.lua). Outdated game version info come a synchronization of a temp game folder from steam, and then a check of "version.txt". Unfortunately, the Steam API doestn't provide this information.Finally, mod graceful shutdown prints the number of player in the game log. This game log is scanned by the script to know when if it can gracefuly shutdown. Q. Will users be able to join even if the Graceful Shutdown mod is not published on steam workshop?A. Yes. It's a server-side only mod anyway. Q. Is the Graceful Shutdown mod required?A. No, if the mod is not enabled, attempts to gracefuly shutdown will silently fail (with an error in the game log.txt) but forced shutdown will work. Special commands: None of those commands actually start an updater screen.They are just tools that you launch in a separate terminal. To shutdown the game server n°2 (and its master/slave), the updater script linked to it and the game check routine:./auto_update_dst.sh 2 shut-or-./auto_update_dst.sh 2 shut nosaveTo delete save of the game server n°2 (and its master/slave). Make sure the server is shutdown before:./auto_update_dst.sh 2 delsaveTo stop waiting and force all next steps: (take care with this, it can actually start the secondary cave server while mods are not fully downloaded by the primary!)./auto_update_dst.sh check Credits go to jacklul, for the first release of the Graceful Shutdown mod code and interaction with the game screen! Link to comment Share on other sites More sharing options...
ToNiO55 Posted September 11, 2015 Share Posted September 11, 2015 @noice, very nice noice, but unfortunatly i don't going used your script because you need wait the server is empty for make update i prefer wait better system but i think that's going interesting for other admin of server Link to comment Share on other sites More sharing options...
noice Posted September 11, 2015 Author Share Posted September 11, 2015 @noice, very nice noice, but unfortunatly i don't going used your script because you need wait the server is empty for make update Hi ToNiO55, Indeed, that's what Graceful Shutdown does: it waits until there's no player before shutdown/update/restart. Forced Shutdown is a different method, that waits until 3:00AM.Forced Shutdown can be disabled in version 1.1:DST_allow_forced_shutdown=true # Allow Forced Shutdown method Link to comment Share on other sites More sharing options...
ToNiO55 Posted September 13, 2015 Share Posted September 13, 2015 Hi @noice, thx you noice but my main problem is loading the mods that is sometimes too long through the workshop, which is why I prefer a web server as this is faster, I wish all just another solution for the management of mods, Moreover it will interesting if we have a load status of mods, such as loading percentages for each mods when you connect on the server, which that's interesting for players to see what downloads and how many mods and how many times, this system is already used on many servers of games suddenly I had to remove many mods my servers, and update problem is not apparently for me because my servers are updated + restart every day at 6:00 am with another scriptbut thank you anyway for your script, I am sure it's probably interesting for other admin Link to comment Share on other sites More sharing options...
Knight1988 Posted September 21, 2015 Share Posted September 21, 2015 Hi. When i run the autoupdate script.If the server is running, it said server not running and start a new instance.If the server is not running, it said server is running. that wierd. Link to comment Share on other sites More sharing options...
noice Posted September 21, 2015 Author Share Posted September 21, 2015 Hi. When i run the autoupdate script.If the server is running, it said server not running and start a new instance.If the server is not running, it said server is running. that wierd. Do you have "DST01" in the script config?DST_screen_name="DST01"You must NOT use "DST" alone as screen name or it will conflict with "DSTUPDATER01". What is your server screen name when it is running? Check with screen -lssteam@***:~$ screen -lsThere are screens on: 9300.DST01 (21/09/2015 11:17:14) (Detached) 3773.DSTUPDATER01 (20/09/2015 09:39:58) (Attached) Link to comment Share on other sites More sharing options...
Knight1988 Posted September 22, 2015 Share Posted September 22, 2015 OH. I used "DST" as the server. Link to comment Share on other sites More sharing options...
artemiyME Posted October 10, 2015 Share Posted October 10, 2015 Hey I've been trying to run your script on current Caves Beta branch with main server and Caves on 2 separate conf folders, linked together as required. Running Ubuntu Server 15.04 amd64 (64bit) with i386 (multiarch) for game servers I have 2 different shell sript startup files that I used before and they worked fine, I was looking to use your mod to eas my life on updating it and restarting it when it crashes. So far I was able to setup everything except Caves do not want to start with your script for some reason, Main DST screen works fine, when I type in './auto_update_dst.sh 2' in shell everything loads and says its fine but actual Caves screen crashes and here are the logs for that. It seems like something with curl is happening? idk meanwhile if I run my old shell script for Caves screen - everything works fine, but I think the updater will not work in caves in that case, which i want it to. this is a very nice script you guys got, hopefully it can work for Caves! -artemiylog.txtlog-updater.txt Link to comment Share on other sites More sharing options...
noice Posted October 11, 2015 Author Share Posted October 11, 2015 Hey I've been trying to run your script on current Caves Beta branch Hello artemiyME, I've not yet tried the beta branch, but I'll check early next week at home to make the updater compatible with caves beta. At this time, the updater script is not compatible with caves beta. From what I see in the offiial Caves thread, the game update command is different:steamcmd +login anonymous +app_update 343050 -beta cavesbeta validate +quitThe updater script doesn't use this "-beta cavesbeta". This would require some changes in the updater script to support both the regular game update check process and the caves game update check process. So by comparing your cave install with a regular (non-cave) install, the updater scripts considers your server is outdated and tries to update your cave game folder with the regular game. And of course, this is not going to work... By now, re-synchronize your cave game folder with steamcmd (using the beta branch) if needed, and then run your cave server without the updater script (but inside a screen, named whatever you want but without spaces). I'll provide a new release of the updater script during the coming week to deal with caves. EDIT: There has been a lot of work to synchronize the updates of the cave master and slave servers. It's now in testing phase. I should release the updater tomorrow. Link to comment Share on other sites More sharing options...
noice Posted October 17, 2015 Author Share Posted October 17, 2015 @artemiyME: Caves are now supported in version 1.3. You need to update the mod files also and restart your server. Link to comment Share on other sites More sharing options...
artemiyME Posted October 18, 2015 Share Posted October 18, 2015 Awesome! I will try it out, you are the best. - artemiy Link to comment Share on other sites More sharing options...
Gingerbread Posted October 30, 2015 Share Posted October 30, 2015 If no user is playing shutdown server This part is not really a cool idea.. That might be different but i will try if i cant find any other solution.. Link to comment Share on other sites More sharing options...
jacklul Posted October 30, 2015 Share Posted October 30, 2015 This part is not really a cool idea.. That might be different but i will try if i cant find any other solution..Why? It makes sure the server is empty before restarting and updating it. Shutting server down when people are playing would only damage server's reputation. Link to comment Share on other sites More sharing options...
Gingerbread Posted October 30, 2015 Share Posted October 30, 2015 Why? It makes sure the server is empty before restarting and updating it. Shutting server down when people are playing would only damage server's reputation.Well script is awesome its ready and such but i really try to write by myself for learning purpose. If I fail to do so, I will take a look into this for sure. I just want something that announces and restarts same save in a minute so people can continue to play. These updates do not happen every so often. it is at most twice a week. I update the server even there is 5 people in my server and never observed that the reputation went down. If you announce that there is an update i am sure they will find it sensible. Actually i am looking for a way to get the version number through steamcmd. Could not really find a way to do so. If I fail to make a script by myself, wanna use this one for sure.. Thanks for the help jacklul you are awesome Link to comment Share on other sites More sharing options...
noice Posted October 30, 2015 Author Share Posted October 30, 2015 Well, if you insist to do it manually, that's your choice. I don't see the point but whatever. I just want something that announces and restarts same save in a minute Actually i am looking for a way to get the version number through steamcmd. The first part is actually extremely basic. Console:c_announce("Hi folks, you will be disconnected in 2 minutes.")-wait-c_shutdown(true)Source: http://dont-starve-game.wikia.com/wiki/Console/Don't_Starve_Together_Commands The known ways to get the last version number is:- Check the forum announcements- Make a copy of the game into an other folder- Run the client version of DST in Steam, launch the game and check the version- Check on http://dstservers.jacklul.com/findmyserver if your server is outdated. But I don't know the update frequency of the last game version The current version number is in version.txt in the game folder. Link to comment Share on other sites More sharing options...
Gingerbread Posted October 31, 2015 Share Posted October 31, 2015 The current version number is in version.txt in the game folder. Seems like it is also possible to write a script that allows to download the update to a dummy directory like for example every other 5 minutes and then check the version.txt file in dummy directory and version.txt in server with diff command? So if they are any different it means that a new update is released.. I wonder if it works this way? Link to comment Share on other sites More sharing options...
Gingerbread Posted October 31, 2015 Share Posted October 31, 2015 The current version number is in version.txt in the game folder. I checked this method and it seems to work...diff -q /path/to/dummyfolder/dst_server/version.txt /path/to/server/dst_server/version.txI tried this and it was a lucky moment that linux told me that they differ. I surprised and checked my steam and there was really an update. It was perfect timing. Thanks for the help noice The thing is I am working on shell scripting. I am very new to linux and wanted to make a script by myself to learn using terminal better. This method will allow me to write my own autoupdate script cuz I can send an automessage in my server can autosave progress shutdown update and restart.. All of them was easy but i was looking for a way to check for the updates if there is any available and your very last sentence helped me alot.. I was almost desperate Many thanks. Link to comment Share on other sites More sharing options...
yohoo Posted November 16, 2015 Share Posted November 16, 2015 Thanks for that,it's working on my cavebeta server. But i don't know how to shut it down.I typed "./auto_update_dst.sh shut" ,but it didn't work. What can i do? THANKS Link to comment Share on other sites More sharing options...
noice Posted November 20, 2015 Author Share Posted November 20, 2015 Thanks for that,it's working on my cavebeta server. But i don't know how to shut it down.I typed "./auto_update_dst.sh shut" ,but it didn't work. What can i do? THANKS Hi, The command is:./auto_update_dst.sh 2 shutNotice the "2", this is is the server number (caves or master, whatever you started the updater with). Beware, it shuts down BOTH the game AND the updater. If you just want to kill the updater only, do:screen -lsscreen -r D_S_T_UPDATERDST0xWith D_S_T_UPDATERDST0x being your updater screen name.Then Ctrl+C And also:screen -r D_S_T_GAMECHECKROUTINEThen Ctrl+C Link to comment Share on other sites More sharing options...
Mahoushoujo Posted December 25, 2015 Share Posted December 25, 2015 Hi. I have read the instruction about multiple server setup but I am quite confused now. I have 4 servers, two different ones with their slaves. However, they share the same game directory, which is "/home/steam/steamapps/DST/". In the instruction you have said never use the same directory for multiple different servers. Does that mean I should copy it? I guess it will take even more space. Is there a better solution? Could you please have a look at it? Link to comment Share on other sites More sharing options...
judas Posted December 27, 2015 Share Posted December 27, 2015 Unsure what is causing these errors.I can run the servers fine without the script.My paths are./home/steam/steamapps/{starve,cave}/home/steam/.klei/{starve,cave}./auto_update_dst.sh: 26: ./auto_update_dst.sh: DST_game_path[1]=/home/steam/steamapps/starve: not found./auto_update_dst.sh: 27: ./auto_update_dst.sh: DST_conf_dirname[1]=starve: not found./auto_update_dst.sh: 29: ./auto_update_dst.sh: DST_screen_name[1]=starve: not found./auto_update_dst.sh: 34: ./auto_update_dst.sh: DST_game_beta[1]=public: not found./auto_update_dst.sh: 35: ./auto_update_dst.sh: DST_allow_forced_shutdown[1]=true: not found./auto_update_dst.sh: 38: ./auto_update_dst.sh: DST_game_path[2]=/home/steam/steamapps/cave: not found./auto_update_dst.sh: 39: ./auto_update_dst.sh: DST_conf_dirname[2]=cave: not found./auto_update_dst.sh: 40: ./auto_update_dst.sh: DST_screen_name[2]=cave: not found./auto_update_dst.sh: 41: ./auto_update_dst.sh: DST_game_beta[2]=public: not found./auto_update_dst.sh: 42: ./auto_update_dst.sh: DST_allow_forced_shutdown[2]=true: not found./auto_update_dst.sh: 95: ./auto_update_dst.sh: [[: not found./auto_update_dst.sh: 100: ./auto_update_dst.sh: Bad substitution Link to comment Share on other sites More sharing options...
noice Posted January 1, 2016 Author Share Posted January 1, 2016 Hi. I have read the instruction about multiple server setup but I am quite confused now. I have 4 servers, two different ones with their slaves. However, they share the same game directory, which is "/home/steam/steamapps/DST/". In the instruction you have said never use the same directory for multiple different servers. Does that mean I should copy it? I guess it will take even more space. Is there a better solution? Could you please have a look at it? Hi. I don't recommend using the same game path for different servers, except for the main world & caves of the same game server (same "shard"), in this case this is fully supported. The two main issues are that the game directory contains:the game, obviouslythe mods (and sometimes mods config also)When you or the script restarts a server (let's say main world server n°1), it may update the game and the mod directory, whereas you may have another server running (eg. main world server n°3) that is using a different game or mods version. This could at worse crash the other server and corrupt the game files. OpenDedup is an option if disk space is an issue. Link to comment Share on other sites More sharing options...
noice Posted January 1, 2016 Author Share Posted January 1, 2016 Unsure what is causing these errors.I can run the servers fine without the script.My paths are./home/steam/steamapps/{starve,cave}/home/steam/.klei/{starve,cave}./auto_update_dst.sh: 26: ./auto_update_dst.sh: DST_game_path[1]=/home/steam/steamapps/starve: not found./auto_update_dst.sh: 27: ./auto_update_dst.sh: DST_conf_dirname[1]=starve: not found./auto_update_dst.sh: 29: ./auto_update_dst.sh: DST_screen_name[1]=starve: not found./auto_update_dst.sh: 34: ./auto_update_dst.sh: DST_game_beta[1]=public: not found./auto_update_dst.sh: 35: ./auto_update_dst.sh: DST_allow_forced_shutdown[1]=true: not found./auto_update_dst.sh: 38: ./auto_update_dst.sh: DST_game_path[2]=/home/steam/steamapps/cave: not found./auto_update_dst.sh: 39: ./auto_update_dst.sh: DST_conf_dirname[2]=cave: not found./auto_update_dst.sh: 40: ./auto_update_dst.sh: DST_screen_name[2]=cave: not found./auto_update_dst.sh: 41: ./auto_update_dst.sh: DST_game_beta[2]=public: not found./auto_update_dst.sh: 42: ./auto_update_dst.sh: DST_allow_forced_shutdown[2]=true: not found./auto_update_dst.sh: 95: ./auto_update_dst.sh: [[: not found./auto_update_dst.sh: 100: ./auto_update_dst.sh: Bad substitution Hi judas,These are errors related to the unability to proceed bash-specific features, like arrays and bash tests.It seems that the script is not interpreted by bash but by another shell interpreter.Maybe you don't have bash, or bash is not at /bin/bash, or your bash version is obsolete (< v4).What is your Operating System?Please provide the output of:/bin/bash --version Link to comment Share on other sites More sharing options...
judas Posted January 1, 2016 Share Posted January 1, 2016 GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)Output of "which bash" is "/bin/bash" But my default shell is zsh. You are correct though, if i run bash instead of zsh it works fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.