當 EC2 正在運作時,排程器無法在 Windows Server 2016 EC2 執行個體 aws 上執行?

當 EC2 正在運作時,排程器無法在 Windows Server 2016 EC2 執行個體 aws 上執行?

我設定了一些批次檔來在視窗上執行 python 腳本。我已透過雙擊批次檔來確認批次檔是否有效,這會啟動 CMD 以顯示正在執行的腳本。

我已經設定了一個任務排程器來啟動批次文件,並透過點擊任務排程器 GUI 上的「執行」按鈕來測試它。

EC2 執行個體始終啟動並執行,但當我關閉 EC2 執行個體的遠端桌面應用程式時,任務排程器不會啟動我的腳本。我究竟做錯了什麼?我希望任務計劃程式運行,無論我是否可以看到桌面。

我正在使用 Mac 遠端存取 EC2 執行個體(如果有幫助的話)。對於如此深入地使用視窗也是非常陌生的。

先感謝您。

編輯:

bat檔案設定:

@echo off
python C:\folder\folder\pythonscript.py %*
pause

調度程序設定:

General Tab:
(checked) Run whether user is logged on or not
(checked) Run with highest privileges
Running as admin on local computer

Trigger Tab:
(checked) Daily
Recur every 1 day
(checked) repeat task every 1 min for duration 'indefinite" ----this is for testing
(checked) Enabled

Actions Tab:
Action: start a program
Program/script: C:\folder\bat_files\test.bat
Add Arguments(optional): blank
Start In(optional): blank

Conditions Tab:
(checked) start the task only if the computer is on AC power
(checked) Stop if computer switches to battery power
(checked) Wake the computer to run task

Settings Tab:

(checked) Allow task to be run on demand
(checked) Run task as soon as possible after schedule is missed
(checked) if task fails, restart every 1 min

答案1

可能有多種情況,但根據您提供的描述,如果Windows 任務規劃程式中的每個設定都正確,並且當系統使用者使用GUI 模式登入時運作良好,則可能與python 腳本有關,該腳本可能需要恆定的GUI 模式才能執行。您也可以在本機系統上檢查相同的任務。

另外,請檢查下面的連結是否與 Sysprep 相關並進一步發布。 https://support.microsoft.com/en-in/help/253942/fix-task-scheduler-task-only-runs-in-the-background-after-you-use-sysp

相關內容