lenosisnickerboa / csgosl

A CSGO server launcher, one-click install & run
GNU General Public License v3.0
378 stars 39 forks source link

#Question: How to run this app as service... #306

Open Peter82kr opened 3 years ago

Peter82kr commented 3 years ago

... to prevent closing after user log off on windows? Is it possible?

lenosisnickerboa commented 3 years ago

Should work but I don't know, haven't tried it. Your best chance would be starting the .bat-file /bin/cmd-start.bat as a service. It which will start csgo with all the settings you've made in csgosl (you can try starting this bat-file directly to see that your server starts as expected).

Googling "run bat script as a service" shows several solutions, e.g. stackoverflow or AlwaysUp AlwaysUp2 (will cost you 50$)

Please report back if it works or not, could be good to include on the wiki.

Peter82kr commented 3 years ago

Used iexpress.exe built in windows server 2019 to convert batch file to exe. Then used this: https://nssm.cc/ to setu up exe as system service. Service is set with delayed start to prevent any lag or slowdowns., and set to not display any windows or consoles.Also set with high priority. Succesfully run csgo server w/o loging into windows server 2019 im using desktop expierience server. Now i have question. Before that steps i set server to reboot at 6 am and update during restart. It will work same when batch command are run w/o starting csgosl? Im currently using standalone-server-start.bat converted to exe but i dont know do it will reboot srcds and update.

lenosisnickerboa commented 3 years ago

Thanks for describing your solution! Regarding: " i set server to reboot at 6 am and update during restart." I assume you mean you have used the csgosl "Restart server options" and set it to restart at 6 am? That requires csgosl to be running and controlling the restart. Guess that's not what you want since you want to run the server regardless of if you're logged in or not (and is running csgosl). I would suggest restarting the windows service instead at a certain time (6 am) and when it restarts it will perform the update as well (since that is part of the standalone-server-start.bat script if you enabled the standaloneupdate option). I would also think not converting the bat-file to an exe would make it easier to maintain if you change options in csgosl. csgosl will automatically update the standalone-server-start.bat script but the conversion to exe will not take place.