Tyrsis / SE-Community-Mod-API

Space Engineers Community Modding API
GNU Lesser General Public License v3.0
23 stars 11 forks source link

Cannot start SEServerExtender from a Scheduled Task #20

Open RononDex opened 9 years ago

RononDex commented 9 years ago

Also I am currently having some issues with starting up the SE Server automatically when the server starts (as my server makes a restart every day).

What I am doing at the moment is the following: I have programmed a Scheduled Task that executes the folowing bat file:

@echo off
D:
cd "D:\Server Applications\SteamLibrary\SteamApps\common\SpaceEngineers\DedicatedServer64\"
SEServerExtender.exe instance="TSCM No PvP" autosave=5 wcfport=8000 restartoncrash autostart nogui

The bat file works perfectly when I execute it manually. The scheduled tasks runs with the administrator account and has the highest privileges it can have. Also it runs wether the user is logged in or not. When I try to start the scheduled task, it enters "Running" state for a second or so and then switches to "ready" without the server starting and pointing anything out in the logfiles. In the event Viewer I see in the "Application" Category that there is an error entry matching the time of the attempted start saying: "Service cannot be started. The service process could not connect to the service controller"

Does anyone know what could be wrong here? I have a minecraft server that I start the same way (using a bat file) and using the exact same settings for the scheduled task that works.

LordNex commented 9 years ago

It would be better to create a service using the SC command and then use argument variables to specify your start up parameters instead of a batch script. Then if you want to have a restart use SESE Essentials with a similar start up as whats below to restart your server at specific intervals.

Sometimes I use just the service but you wont get the GUI for administration and will have to do everything by logging into the game itself. Most of time I just run it through RDP with a shortcut like below and then disconnect. You can change some of those around and there are a few other arguments you could add if needed.

C:\SEDedicated\SEServerExtender.exe autostart autosave=10 restartoncrash instance="POWSE" path="C:\SEDedicated\POWSE"