Add init and config files from #2624
[packages.git] / net / autossh / files / autossh.init
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
+}