Skip to content

Instantly share code, notes, and snippets.

@jayliew
Created January 9, 2018 18:57
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 jayliew/880d2948d7e0382580e471b44f4bc34f to your computer and use it in GitHub Desktop.
Save jayliew/880d2948d7e0382580e471b44f4bc34f to your computer and use it in GitHub Desktop.
Ubuntu 16.04 systemd service starter script
[Unit]
Description=SSH Tunnel for MySQL
After=network.target
[Service]
Restart=always
RestartSec=20
User=unprivilegedusername
ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -L 3306:127.0.0.1:3306 username@hostactuallyrunningmysqld
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment