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.5K Connect
- 1.2K Connectors
- 296 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 677 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 45 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive