Skip to main content

Suppress console output in PowerShell/Batch

· One min read

Powershell When exception is occured, Out-Null is actually not worked, so uses

Get-ChildItem aaa >$null 2>&1

Or in Powershell 3

Get-ChildItem aaa *>$null

Batch/Dos

dir aaa >nul 2>&1

Gitlab pages throws 502

· One min read

Intermittent 502 errors or after a few days If you run Pages on a system that uses systemd and tmpfiles.d, you may encounter intermittent 502 errors trying to serve Pages with an error similar to:

dial tcp: lookup gitlab.example.com on [::1]:53: dial udp [::1]:53: connect: no route to host"

GitLab Pages creates a bind mount inside /tmp/gitlab-pages-* that includes files like /etc/hosts. However, systemd may clean the /tmp/ directory on a regular basis so the DNS configuration may be lost.

  1. To stop systemd from cleaning the Pages related content: 1. Tell tmpfiles.d to not remove the Pages /tmp directory:
echo 'x /tmp/gitlab-pages-*' >> /etc/tmpfiles.d/gitlab-pages-jail.conf
  1. Restart GitLab Pages:
sudo gitlab-ctl restart gitlab-pages
ClustrMaps