Scheduling workbench jobs with a batch file and windows task scheduler
Best Answer
-
- Create a bat file to call the jobs.
- They will run in the order that you list them, so you can put multiple jobs in one batch file. For those not familiar with batch files, it is basically a .txt file with .bat as the file type. I recommend using Notepad++ to create them, but you can also use Windows Notepad.
- Command line: "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 495
- In here you are calling the program workbench and running job 495. The workbench job ID can be found in workbench on the overview of the job (click on the job name).
- If you want another job, on the next line, just repeat: "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 496
- Create a task in the windows task scheduler.
- If this is on a server, I recommend on the general tab of the task to set SYSTEM as the user account when running the task and check run whether user is logged in or not and run with highest privileges.
- Set the trigger. Usually this will be a certain time of the day/week/month. You can have multiple triggers.
- Set the action: This is where you will "Start a program" and reference the bat file that you created in the first step. You can have multiple actions to call bat files one after another.
- Other settings: if the job fails, you can have it retry. You can also set a timeout so the job doesn't run too long.
So you can have multiple workbench jobs in one bat file and you can have multiple bat files in a single task in windows scheduler.
Once you test your first bat file, you can get creative and start writing out a log that you can then upload to Domo. Below is an example where we have the start and end times for the job written to a text file. There is another job in workbench that will upload the text file to Domo every 15 minutes.
- (echo Started Job Win_WMS_MRZ 495 %DATE:~-4%-%DATE:~4,2%-%DATE:~7,2% %time:~0,2%:%time:~3,2%:%time:~6,2%) >> C:\ProgramData\Domo\Workbench\Groups\batch_log.txt
- "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 495
- (echo Completed Job Win_WMS_MRZ 495 %DATE:~-4%-%DATE:~4,2%-%DATE:~7,2% %time:~0,2%:%time:~3,2%:%time:~6,2%) >> C:\ProgramData\Domo\Workbench\Groups\batch_log.txt
Hope this helps.
Thanks,
Josh
3 - Create a bat file to call the jobs.
Answers
-
- Create a bat file to call the jobs.
- They will run in the order that you list them, so you can put multiple jobs in one batch file. For those not familiar with batch files, it is basically a .txt file with .bat as the file type. I recommend using Notepad++ to create them, but you can also use Windows Notepad.
- Command line: "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 495
- In here you are calling the program workbench and running job 495. The workbench job ID can be found in workbench on the overview of the job (click on the job name).
- If you want another job, on the next line, just repeat: "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 496
- Create a task in the windows task scheduler.
- If this is on a server, I recommend on the general tab of the task to set SYSTEM as the user account when running the task and check run whether user is logged in or not and run with highest privileges.
- Set the trigger. Usually this will be a certain time of the day/week/month. You can have multiple triggers.
- Set the action: This is where you will "Start a program" and reference the bat file that you created in the first step. You can have multiple actions to call bat files one after another.
- Other settings: if the job fails, you can have it retry. You can also set a timeout so the job doesn't run too long.
So you can have multiple workbench jobs in one bat file and you can have multiple bat files in a single task in windows scheduler.
Once you test your first bat file, you can get creative and start writing out a log that you can then upload to Domo. Below is an example where we have the start and end times for the job written to a text file. There is another job in workbench that will upload the text file to Domo every 15 minutes.
- (echo Started Job Win_WMS_MRZ 495 %DATE:~-4%-%DATE:~4,2%-%DATE:~7,2% %time:~0,2%:%time:~3,2%:%time:~6,2%) >> C:\ProgramData\Domo\Workbench\Groups\batch_log.txt
- "C:\Program Files\Domo\Workbench\wb.exe" run-Job -s daltile.domo.com -j 495
- (echo Completed Job Win_WMS_MRZ 495 %DATE:~-4%-%DATE:~4,2%-%DATE:~7,2% %time:~0,2%:%time:~3,2%:%time:~6,2%) >> C:\ProgramData\Domo\Workbench\Groups\batch_log.txt
Hope this helps.
Thanks,
Josh
3 - Create a bat file to call the jobs.
-
Hi,
I followed all the steps described above and every time I try to run it I get this error.
Here is the code I'm using inside the batch file:
start "C:\Program Files\Domo\Workbench\wb.exe" "run-Job -s daltile.domo.com -j 159"
Any thoughts?
1 -
Try removing the quotes around the "run-job" portion. Weirdly for me that works only having the path in quotes.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 101 SQL DataFlows
- 622 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 748 Beast Mode
- 59 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 396 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 125 Manage
- 122 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 109 Community Announcements
- 4.8K Archive