I have to download a file from an SFTP server everyday. I have the program which retrieves the file from the server but I was thinking of setting up a cron job (or anything similar) to automate that. We are a Windows shop and need to set up the cron job in Windows.
- Go to Start >> Control Panel >> Scheduled Tasks >> Add Scheduled Task. - Type "Moodle Cron" as the name of the task and select "Daily" as the schedule. Click "Next". - Select "12:00 AM" as the start time, perform the task "Every Day" and choose today's date as the starting date.
First, in the main window of the Task Scheduler, scroll down until you see your task name. If you used the name “cron,” it should be found toward the top of the list. Right-click the task and select “Run.” Then, go back to your WSL terminal and type in sudo service cron status , and it should say that cron is running.
On Microsoft Windows, cron jobs are known as Scheduled Tasks. They can be added through the Windows Task Scheduler user interface, by using PowerShell or with help of schtasks.exe . Running a task at specific time or at recurring dates is one of the common administrative tasks on all operating systems.
The windows equivalent to a cron job is a scheduled task.
A scheduled task can be created as described by Alex and Rudu, but it can also be done command line with schtasks
(if you for instance need to script it or add it to version control).
An example:
schtasks /create /tn calculate /tr calc /sc weekly /d MON /st 06:05 /ru "System"
Creates the task calculate, which starts the calculator(calc) every monday at 6:05 (should you ever need that.)
All available commands can be found here: http://technet.microsoft.com/en-us/library/cc772785%28WS.10%29.aspx
It works on windows server 2008 as well as windows server 2003.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With