#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
[[ -f /etc/conf.d/sshtunnel ]] && . /etc/conf.d/sshtunnel
user=florian
pid=$(cat /run/sshtunnel.pid 2>/dev/null)
case "$1" in
start)
stat_busy "Starting sshtunnel"
if [ -z "$pid" ]; then
su - florian -c 'AUTOSSH_GATETIME=0 /usr/bin/autossh -M 20000 -q -n -N -D 9999 -R 1337:localhost:1337 -R 2222:localhost:222 -p 222 florian@the-compiler.org &>/dev/null' &>/dev/null &
echo "$!" > /run/sshtunnel.pid
fi
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon sshtunnel
stat_done
fi
;;
stop)
stat_busy "Stopping sshtunnel"
[ ! -z "$pid" ] && kill $pid &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm /run/sshtunnel.pid
rm_daemon sshtunnel
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}