Skip to content

Instantly share code, notes, and snippets.

@yvh
Forked from v-jacob/Mailhog Bash Script (systemd)
Last active January 16, 2017 12:48
Show Gist options
  • Save yvh/7241dc5d89d4f96baf1c89cc450ec546 to your computer and use it in GitHub Desktop.
Save yvh/7241dc5d89d4f96baf1c89cc450ec546 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
sudo wget --quiet -O /usr/local/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
# Make it executable
sudo chmod +x /usr/local/bin/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 /usr/local/bin/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