To run a tunnel on Linux startup, follow these steps:
Open a Terminal:
Create a Shell Script:
Use a text editor to create a shell script. For example, you can use nano
:
sudo nano /usr/local/sbin/my-startup.sh
Paste your Pinggy command into the script. For example:
#!/bin/sh
ssh -p 443 -R0:localhost:8000 -o StrictHostKeyChecking=no
-o ServerAliveInterval=30 a.pinggy.io
You can customize the command here:
Make the Script Executable:
sudo chmod +x /usr/local/sbin/my-startup.sh
Create a Systemd Service File:
Use a text editor to create a systemd service file. For example:
sudo nano /etc/systemd/system/my-startup.service
Paste the following content into the file:
[Unit]
Description=Pinggy Tunnel Startup
[Service]
ExecStart=/usr/local/sbin/my-startup.sh
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
Save and exit the text editor.
Reload Systemd and Enable the Service:
sudo systemctl daemon-reload
sudo systemctl enable my-startup.service
Check Service Status:
Run the following command to check the status of your service:
sudo systemctl status my-startup.service
View Service Logs:
sudo journalctl -u my-startup.service
Now, your Pinggy tunnel will automatically execute each time your Linux system starts up.