mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-23 07:57:39 +00:00
b9996e63c8
HTML files in /templates/docs/ are not Django templates, they contain HTML content to be used verbatim in hc.front.views.serve_doc view. Some of these files contain "{{ ... }}" syntax. When we run "./manage.py compress", django-compressor trips up on this syntax because it treats them as Django templates. The fix is to change file extension for these files from .html to something else (I picked .html-fragment) so django-compressor would ignore them.
25 lines
1.9 KiB
Plaintext
25 lines
1.9 KiB
Plaintext
<h1>PowerShell</h1>
|
|
<p>You can use <a href="https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.2">PowerShell</a>
|
|
and Windows Task Scheduler to automate various tasks on a Windows system.
|
|
From within a PowerShell script, it is also easy to ping SITE_NAME.</p>
|
|
<p>Here is a simple PowerShell script that pings SITE_NAME. When scheduled to
|
|
run with Task Scheduler, it will send regular "I'm alive" messages.
|
|
Of course, you can extend it to do more things.</p>
|
|
<div class="highlight"><pre><span></span><code><span class="c"># Save this in a file with a .ps1 extension, e.g. C:\Scripts\healthchecks.ps1</span>
|
|
<span class="c"># The command to run it:</span>
|
|
<span class="c"># powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1</span>
|
|
<span class="c">#</span>
|
|
<span class="nb">Invoke-RestMethod</span> <span class="n">PING_URL</span>
|
|
</code></pre></div>
|
|
|
|
<p>You can send additional diagnostic information in HTTP POST requests:</p>
|
|
<div class="highlight"><pre><span></span><code><span class="nb">Invoke-RestMethod</span> <span class="n">-Uri</span> <span class="n">PING_URL</span> <span class="n">-Method</span> <span class="n">Post</span> <span class="n">-Body</span> <span class="s2">"temperature=-7"</span>
|
|
</code></pre></div>
|
|
|
|
<p>For other parameters, you can use in the <code>Invoke-RestMethod</code> cmdlet,
|
|
see the official <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.2">Invoke-RestMethod documentation</a>.</p>
|
|
<p>As an alternative to putting the script in a .ps1 file, you can also pass it
|
|
to PowerShell directly, using the "-Command" argument:</p>
|
|
<div class="highlight"><pre><span></span><code># Pass the command to PowerShell directly:
|
|
powershell.exe -Command <span class="s2">"&{Invoke-RestMethod PING_URL}"</span>
|
|
</code></pre></div> |