Created
July 31, 2012 21:50
-
-
Save georgeredinger/3220935 to your computer and use it in GitHub Desktop.
raspberrypi reverse ssh tunnel upstart scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pi@raspberrypi ~ $ cat /etc/init/ssh_tunnel.conf | |
#!upstart | |
author "george" | |
description "SSH Tunnel" | |
start on stopped rc | |
stop on shutdown | |
script | |
echo "`date` autossh" > /var/log/ssh_tunnel.sys.log | |
exec /usr/bin/autossh -R 31416:localhost:22 -N [email protected] -i /root/.ssh/id_rsa | |
end script | |
pi@raspberrypi ~ $ cat /etc/init/web_tunnel.conf | |
#!upstart | |
description "Web Tunnel" | |
author "george" | |
start on stopped rc | |
stop on shutdown | |
script | |
echo "`date` autossh" >> /var/log/web_tunnel.sys.log | |
exec /usr/bin/autossh -R 31415:localhost:31415 -N [email protected] -i /root/.ssh/id_rsa | |
end script | |
----- | |
#!upstart | |
description "pi node.js server" | |
author "george" | |
start on started web_tunnel | |
stop on shutdown | |
script | |
export HOME="/home/pi" | |
echo $$ > /var/run/pi.pid | |
exec sudo -u pi /usr/local/bin/node /home/pi/workspace/pi/app.js >> /var/log/pi.sys.log 2>&1 | |
end script | |
respawn | |
pre-start script | |
# Date format same as (new Date()).toISOString() for consistency | |
echo "[`date `] Starting" >> /var/log/pi.sys.log | |
end script | |
pre-stop script | |
rm /var/run/pi.pid | |
echo "[`date `] Stopping" >> /var/log/pi.sys.log | |
end script | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment