Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbowyer/2fb0a7c8ddedcc6906b552313f667ea8 to your computer and use it in GitHub Desktop.
Save pbowyer/2fb0a7c8ddedcc6906b552313f667ea8 to your computer and use it in GitHub Desktop.
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
# Make it start on reboot
sudo tee /etc/systemd/system/mailhog.service <<EOL
[Unit]
Description=MailHog Service
After=network.service vagrant.mount
[Service]
Type=simple
ExecStart=/usr/bin/env /home/vagrant/mailhog > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
EOL
# Start on reboot
sudo systemctl enable mailhog
# Start background service now
sudo systemctl start mailhog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment