Skip to content

Instantly share code, notes, and snippets.

@v-jacob
Last active January 9, 2023 08:51
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save v-jacob/c31a844042ca5ced6b72ccab3cd6055b to your computer and use it in GitHub Desktop.
Save v-jacob/c31a844042ca5ced6b72ccab3cd6055b 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