WebJobs offers a convenient feature within Azure App Service for running programs or scripts in the same environment as your web apps, without incurring additional costs. This guide walks you through creating a simple Triggered WebJob using NodeJS that outputs the system time every 15 minutes. Begin by setting up an App Service Web App with the Node 20 LTS runtime stack, essential since the WebJob will utilize Node and a bash startup script.
You’ll need a NodeJS script named webjob.js that logs the current time and a bash script run.sh to execute the NodeJS script when the WebJob runs. Compress these two files into a zip archive, webjob.zip, for upload into your App Service Web App. Creating the WebJob in the Azure portal involves uploading the zip file and configuring the schedule with an NCRONTAB expression to run every 15 minutes. Test the setup manually to ensure it’s correctly logging the time. This demonstration of WebJobs showcases their potential to enhance app functionality seamlessly.
News: Getting Started with Linux WebJobs on App Service – NodeJS
Documentation: WebJobs on App Service Documentation