Browse Source

Updated PowerShell example.

pull/133/head
Pēteris Caune 7 years ago
parent
commit
148e85783c
8 changed files with 17 additions and 3 deletions
  1. +1
    -0
      hc/front/management/commands/pygmentize.py
  2. +5
    -0
      templates/front/docs.html
  3. +2
    -2
      templates/front/snippets/crontab.html
  4. +2
    -1
      templates/front/snippets/powershell.html
  5. +1
    -0
      templates/front/snippets/powershell.txt
  6. +3
    -0
      templates/front/snippets/powershell_inline.html
  7. +2
    -0
      templates/front/snippets/powershell_inline.txt
  8. +1
    -0
      templates/front/welcome.html

+ 1
- 0
hc/front/management/commands/pygmentize.py View File

@ -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


+ 5
- 0
templates/front/docs.html View File

@ -157,6 +157,11 @@ the following command in a Scheduled Task to run the script:
<pre>powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1</pre>
</div>
<p>In simple cases, you can also pass the script to PowerShell directly,
using the "-command" argument:</p>
{% include "front/snippets/powershell_inline.html" %}
<a name="email"></a>
<h3>Email</h3>
<p>


+ 2
- 2
templates/front/snippets/crontab.html View File

@ -1,3 +1,3 @@
<div class="highlight"><pre><span></span><span class="c1"># m h dom mon dow command</span>
<span class="m">8</span> <span class="m">6</span> * * * /home/user/backup.sh <span class="o">&amp;&amp;</span> curl -fsS --retry <span class="m">3</span> {{ ping_url }} &gt; /dev/null
<div class="highlight"><pre><span></span><span class="c1"># m h dom mon dow command</span>
<span class="m">8</span> <span class="m">6</span> * * * /home/user/backup.sh <span class="o">&amp;&amp;</span> curl -fsS --retry <span class="m">3</span> {{ ping_url }} &gt; /dev/null
</pre></div>

+ 2
- 1
templates/front/snippets/powershell.html View File

@ -1,2 +1,3 @@
<div class="highlight"><pre><span></span><span class="nb">Invoke-RestMethod</span> <span class="n">{{ ping_url }}</span>
<div class="highlight"><pre><span></span><span class="c"># inside a PowerShell script:</span>
<span class="nb">Invoke-RestMethod</span> <span class="n">{{ ping_url }}</span>
</pre></div>

+ 1
- 0
templates/front/snippets/powershell.txt View File

@ -1 +1,2 @@
# inside a PowerShell script:
Invoke-RestMethod PING_URL

+ 3
- 0
templates/front/snippets/powershell_inline.html View File

@ -0,0 +1,3 @@
<div class="highlight"><pre><span></span><span class="c1"># Without an underlying script, passing the command to PowerShell directly:</span>
powershell.exe -command <span class="p">&amp;</span><span class="o">{</span>Invoke-RestMethod {{ ping_url }}<span class="o">}</span>
</pre></div>

+ 2
- 0
templates/front/snippets/powershell_inline.txt View File

@ -0,0 +1,2 @@
# Without an underlying script, passing the command to PowerShell directly:
powershell.exe -command &{Invoke-RestMethod PING_URL}

+ 1
- 0
templates/front/welcome.html View File

@ -80,6 +80,7 @@
</div>
<div class="tab-pane" id="powershell">
{% include "front/snippets/powershell.html" %}
{% include "front/snippets/powershell_inline.html" %}
</div>
<div class="tab-pane tab-pane-email" id="email">
<p>


Loading…
Cancel
Save