[COI]Naaaath 11 Report post Posted October 29, 2015 (edited) Hello!I've come here to share my method of closing and restarting my server, For some odd reason I was having issues with .bat scripts and I remembered PowerShell is also an option and i've had no issues with it since. Powershell script -> Save as Restarter.ps1 - Change the ArguementList accordingly and the process affinity.Get-Process | Where-Object { $_.Name -eq "arma3server" } | Select-Object -First 1 | Stop-ProcessStart-Sleep -s 5Start-Process arma3server.exe -ArgumentList "-mod=@exile;@mas;@NATO_Rus_Vehicle; -servermod=@ExileServer;@infiSTAR_Exile;@a3_dms;@a3_custom;@A3XAI; -config=@ExileServer\config.cfg -port=2310 -profiles=Config\log -cfg=@ExileServer\basic.cfg -name=Exile -autoinit -enableHT -malloc=tbbmalloc2 -high -maxMem=8192"Start-Sleep -s 2$instances = Get-Process arma3serverforeach ($i in $instances) { $i.ProcessorAffinity=255} Affinity Explanation If you have 4 Cores you would do -> 1+2+4+8 = 15, so you would change $i.ProcessorAffinity=255 to $i.ProcessorAffinity=15 # Set Processor Affinity by adding the number together. For cores 1 – 4 its 15 for example. # 1 (CPU 1) # 2 (CPU 2) # 4 (CPU 3) # 8 (CPU 4) # 16 (CPU 5) # 32 (CPU 6) # 64 (CPU 7) #128 (CPU 8 )Task Scheduler ----------First setup your Task Scheduler to the correct time and then go to the Actions tab and select "New" Program/scriptC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exeAdd arguments C:\Arma\Altis\Restarter.ps1 (Script location)Start inC:\Arma\Altis\ (Folder where the script is) Edited October 29, 2015 by [COI]Naaaath Share this post Link to post Share on other sites
hieve 42 Report post Posted October 30, 2015 (edited) holy shit this looks complex for such a small task. I tried to make it myself as easy as possible: arma3server_start.batD:\a3master1\arma3server.exe -serverMod=@ExileServer;@zbe_cache; -mod=@Exile;@Ryanzombies; -ip=YOURIP -port=YOURPORT -malloc=tbb4malloc_bi -profiles=config -config=config\server.cfg -cfg=config\basic.cfg -name=arma3 -autoinit -enableHTtimeout /T 5exit arma3server_stop.battaskkill /f /im arma3server.exe just add those with your favourite timings to microsofts task management system , config your exile with these timings - go for portability/multi server use , rename the arma3server.exe to for example arma3server_dev.exe , so you can taskkill it without closing all instances Edited October 30, 2015 by hieve Share this post Link to post Share on other sites
[COI]Naaaath 11 Report post Posted October 30, 2015 holy shit this looks complex for such a small task. I tried to make it myself as easy as possible: arma3server_start.batHidden Content arma3server_stop.batHidden Content just add those with your favourite timings to microsofts task management system , config your exile with these timings - go for portability/multi server use , rename the arma3server.exe to for example arma3server_dev.exe , so you can taskkill it without closing all instancesI was having problems with task kill saying "Out of Memory" , it looks complicated but does exactly the same thing It's still a case of copy + paste and setup task scheduler. Share this post Link to post Share on other sites
ka0s 457 Report post Posted October 30, 2015 Nice share. Powershell is way better than batch. There is different opinions about it, however I'm still using batch, but I've also spent several hours making my batch, actually working on a actual application to take care of all this business. (I may release it even, when I get everything sorted out (It's based on a global configuration file from which you define all paths, mods etc etc.)) But a good tip for everyone: I've had several occasions where my server all of a sudden got into hung state / not responding, and were inaccessible until I manually force closed the application. So do yourself a favor and make checks for if application is not responding etc, it's a lifesaver Share this post Link to post Share on other sites
gg!Bohne 0 Report post Posted July 17, 2016 Batch is great for very simple tasks, but if you want any significant control flow it will be simpler in powershell. Powershell also seems a lot more expressive and does not rely on that huge amount of external applications as a batch script does if you want to control stuff other than "start something with these arguments". For my server I wrote a few scripts, that lints over my mods sources, "pboizes" the necessary files, puts together a server environment folder, updates, starts, stops and monitors the server. Once I have them in a presentable state, I'd be happy to share them. My point is that, when a script gets bigger, more functional, the complexity increases a lot faster in batch, than it does in powershell. Share this post Link to post Share on other sites