diff --git a/hc/front/management/commands/pygmentize.py b/hc/front/management/commands/pygmentize.py index a52005a7..48c7d986 100644 --- a/hc/front/management/commands/pygmentize.py +++ b/hc/front/management/commands/pygmentize.py @@ -35,6 +35,7 @@ class Command(BaseCommand): _process("python_requests", lexers.PythonLexer()) _process("php", lexers.PhpLexer()) _process("powershell", lexers.shell.PowerShellLexer()) + _process("powershell_inline", lexers.shell.BashLexer()) _process("node", lexers.JavascriptLexer()) # API examples diff --git a/templates/front/docs.html b/templates/front/docs.html index 02e17114..414dc47b 100644 --- a/templates/front/docs.html +++ b/templates/front/docs.html @@ -157,6 +157,11 @@ the following command in a Scheduled Task to run the script:
powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1+
In simple cases, you can also pass the script to PowerShell directly, +using the "-command" argument:
+ +{% include "front/snippets/powershell_inline.html" %} +diff --git a/templates/front/snippets/crontab.html b/templates/front/snippets/crontab.html index bd8e3fdf..84a57cb9 100644 --- a/templates/front/snippets/crontab.html +++ b/templates/front/snippets/crontab.html @@ -1,3 +1,3 @@ -
# m h dom mon dow command
- 8 6 * * * /home/user/backup.sh && curl -fsS --retry 3 {{ ping_url }} > /dev/null
+# m h dom mon dow command
+ 8 6 * * * /home/user/backup.sh && curl -fsS --retry 3 {{ ping_url }} > /dev/null
diff --git a/templates/front/snippets/powershell.html b/templates/front/snippets/powershell.html
index a2b1a2ea..e0fb55fa 100644
--- a/templates/front/snippets/powershell.html
+++ b/templates/front/snippets/powershell.html
@@ -1,2 +1,3 @@
-Invoke-RestMethod {{ ping_url }}
+# inside a PowerShell script:
+Invoke-RestMethod {{ ping_url }}
diff --git a/templates/front/snippets/powershell.txt b/templates/front/snippets/powershell.txt
index 96a6a1c3..6adcfedf 100644
--- a/templates/front/snippets/powershell.txt
+++ b/templates/front/snippets/powershell.txt
@@ -1 +1,2 @@
+# inside a PowerShell script:
Invoke-RestMethod PING_URL
\ No newline at end of file
diff --git a/templates/front/snippets/powershell_inline.html b/templates/front/snippets/powershell_inline.html
new file mode 100644
index 00000000..1ecb51b5
--- /dev/null
+++ b/templates/front/snippets/powershell_inline.html
@@ -0,0 +1,3 @@
+# Without an underlying script, passing the command to PowerShell directly:
+powershell.exe -command &{Invoke-RestMethod {{ ping_url }}}
+
diff --git a/templates/front/snippets/powershell_inline.txt b/templates/front/snippets/powershell_inline.txt
new file mode 100644
index 00000000..f5ee44c7
--- /dev/null
+++ b/templates/front/snippets/powershell_inline.txt
@@ -0,0 +1,2 @@
+# Without an underlying script, passing the command to PowerShell directly:
+powershell.exe -command &{Invoke-RestMethod PING_URL}
\ No newline at end of file
diff --git a/templates/front/welcome.html b/templates/front/welcome.html
index 28fe7b80..85d34150 100644
--- a/templates/front/welcome.html
+++ b/templates/front/welcome.html
@@ -80,6 +80,7 @@
{% include "front/snippets/powershell.html" %}
+ {% include "front/snippets/powershell_inline.html" %}