Skip to content

Instantly share code, notes, and snippets.

@v-jacob
Last active September 1, 2024 15:47
Show Gist options
  • 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