Add init and config files from #2624
authorFlorian Fainelli <florian@openwrt.org>
Thu, 1 Nov 2007 17:15:42 +0000 (17:15 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Thu, 1 Nov 2007 17:15:42 +0000 (17:15 +0000)
SVN-Revision: 9475

net/autossh/Makefile
net/autossh/files/autossh.config [new file with mode: 0644]
net/autossh/files/autossh.init [new file with mode: 0644]

index 8cbb8bd81ac00a619e0401d313fbda72b0c0da41..97bc1241429772afce0bf43bd197532a1e0c5d5c 100644 (file)
@@ -38,6 +38,10 @@ endef
 define Package/autossh/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/autossh $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/autossh.init $(1)/etc/init.d/autossh
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/autossh.config $(1)/etc/config/autossh
 endef
 
 $(eval $(call BuildPackage,autossh))
diff --git a/net/autossh/files/autossh.config b/net/autossh/files/autossh.config
new file mode 100644 (file)
index 0000000..2e430a0
--- /dev/null
@@ -0,0 +1,4 @@
+config autossh
+       option ssh      '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host'
+       option monitorport      '20000'
+       option poll     '600'
diff --git a/net/autossh/files/autossh.init b/net/autossh/files/autossh.init
new file mode 100644 (file)
index 0000000..faca1c3
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+START=80
+
+start_service () {
+       local section="$1"
+       config_get ssh "$section" ssh
+       config_get monitorport "$section" monitorport
+       config_get poll "$section" poll
+
+       AUTOSSH_POLL=${poll:-"600"} autossh -M ${monitorport:-"20000"} -f ${ssh}
+}
+
+start() {
+       config_load "autossh"
+       config_foreach start_service autossh
+}
+
+stop() {
+       killall autossh
+}
+
+restart() {
+       stop
+       start
+}