我有一个 EC2 WindowsServer2016 映像,上面有一个 scala 项目。我希望它在我启动实例时启动无需我登录或者做任何事情。我有一个.bat
脚本,内容如下:
git pull
sbt run
我在 TaskScheduler 中创建了一个任务。以下是 XML。
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2017-07-19T10:34:17.5913961</Date>
<Author>EC2AMAZ-KLIVN0Q\Administrator</Author>
<URI>\StartServer</URI>
</RegistrationInfo>
<Triggers>
<BootTrigger>
<Enabled>true</Enabled>
</BootTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-1707681336-2717460810-1492664229-500</UserId>
<LogonType>Password</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Users\Administrator\cbf-render-server\run.bat</Command>
<WorkingDirectory>C:\Users\Administrator\cbf-render-server\</WorkingDirectory>
</Exec>
</Actions>
</Task>
问题:每当我通过 RDP 连接到计算机时,服务器就会启动。如果我不通过 RDP 连接到计算机,它似乎永远不会启动。(我通过 curl 健康端点来测试它是否已启动)。
我是 WindowsServer 的新手(UNIX 背景),有人能告诉我我可能做错了什么吗?
谢谢