You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log(`Current system time is: ${formattedTime}`);
197
+
```
198
198
199
199
The file, `run.sh`, calls webjob.js as shown below:
200
200
201
-
```Bash
202
-
#!/bin/bash
201
+
```Bash
202
+
#!/bin/bash
203
+
204
+
node webjob.js
205
+
```
203
206
204
-
node webjob.js
205
-
```
206
207
## Create a scheduled WebJob
207
208
208
209
1. In the [Azure portal](https://portal.azure.com), go to the **App Service** page of your App Service app.
@@ -250,43 +251,43 @@ WebJobs is a feature of Azure App Service that enables you to run a program
250
251
251
252
Digging into the code, our Java project located at `project/src/main/java/webjob/HelloWorld.java` is relatively simple. It just outputs a message & the current time to the console.
The run.sh script located at the root of our git repo, just runs a jar with the name that we’ve setin our maven configuration. This script will run when our WebJob is triggered, and it is the job of this script to kick off our Java executable (jar).
270
271
271
-
```bash
272
-
java -jar webjob-artifact-1.0.0.jar
273
-
```
272
+
```bash
273
+
java -jar webjob-artifact-1.0.0.jar
274
+
```
274
275
275
276
Now we need to compile our Java project to produce the executable jar. There are multiple ways to do this, but for this example, we’ll use Maven. Run the following commands from the `project/` directory:
276
277
277
-
```bash
278
-
mvn install
279
-
mvn package
280
-
```
278
+
```bash
279
+
mvn install
280
+
mvn package
281
+
```
282
+
281
283
After successfully building our app with `mvn package`, our jar file will be located at `project/target/webjob-artifact-1.0.0.jar`.
282
284
283
285
Now we have everything we need to assemble our zip file. Again, there are multiple ways to do this, but for this demo we’ll use the zip CLI utility to create our zip file called `webjob.zip`. First move your jar file to the root of the git repo with ` project/target/webjob-artifact-1.0.0.jar .` Then run the zip command to package our application as a zip file.
284
286
285
-
```bash
286
-
287
-
zip webjob.zip run.sh webjob-artifact-1.0.0.jar
287
+
```bash
288
+
zip webjob.zip run.sh webjob-artifact-1.0.0.jar
289
+
```
288
290
289
-
```
290
291
## Create a scheduled WebJob on Azure
291
292
292
293
1. In the [Azure portal](https://portal.azure.com), go to the **App Service** page of your App Service app.
@@ -332,23 +333,23 @@ You can [download a pre-built sample project](https://github.com/Azure-Samples/A
332
333
333
334
The PHP script, `webjob.php`, outputs the current time to the console as shown below:
334
335
335
-
```PHP
336
-
<?php
337
-
// Get the current time
338
-
$current_time = date("Y-m-d H:i:s");
339
-
340
-
// Display the current time
341
-
echo "The current time is: " . $current_time;
342
-
?>
343
-
```
336
+
```PHP
337
+
<?php
338
+
// Get the current time
339
+
$current_time = date("Y-m-d H:i:s");
340
+
341
+
// Display the current time
342
+
echo "The current time is: " . $current_time;
343
+
?>
344
+
```
344
345
345
346
The file, `run.sh`, calls webjob.php as shown below:
0 commit comments