aboutsummaryrefslogtreecommitdiff
path: root/net/autossh/files/autossh.init
blob: e21b3910befd590c83f75922513a5b12f9e55b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org

START=80

start_instance() {
	local section="$1"

	config_get ssh "$section" 'ssh'
	config_get gatetime "$section" 'gatetime'
	config_get monitorport "$section" 'monitorport'
	config_get poll "$section" 'poll'
	config_get_bool enabled "$section" 'enabled' '1'

	[ "$enabled" = 1 ] || exit 0

	export AUTOSSH_GATETIME="${gatetime:-30}"
	export AUTOSSH_POLL="${poll:-600}"
	service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh}
}

boot() {
	return
}

start() {
	config_load 'autossh'
	config_foreach start_instance 'autossh'
}

stop() {
	service_stop /usr/sbin/autossh
}