简体   繁体   中英

How to setup scheduler task cron in windows server via .ebextensions config?

I have following config file under.ebextensions, I am using windows server 2019 as Elastic bean stalk instance

The deployment failed at this command, Same command is working when we run directly in the terminal (It configures the scheduler task inside windows)

This is what i have tried so far (FILR PATH: .ebextensions/cron.config)

container_commands:
  00_cmd: 
    command: schtasks /create /sc minute /mo 2 /tn "S3 Operations" /tr "C:\Program Files\Amazon\AWSCLIV2\aws.exe s3 sync s3://my-bucket-url C:\inetpub\wwwroot\"

AND

commands:
  00_cmd: 
    command: schtasks /create /sc minute /mo 2 /tn "S3 Operations" /tr "C:\Program Files\Amazon\AWSCLIV2\aws.exe s3 sync s3://my-bucket-url C:\inetpub\wwwroot\"

It was triggering following log:

No mapping between account names and security IDs was done.

Which requires username(/ru) and password(/rp) association along with command, Alternatively you can use System user (which doesn't require any password)

So my new command would be

schtasks /create /ru "System" /sc minute /mo 2 /tn "S3 Operations" /tr "C:\Program Files\Amazon\AWSCLIV2\aws.exe s3 sync s3://my-bucket-url C:\inetpub\wwwroot\"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM