- previously localport option was required, which broke older configs
- now in-config forwarding is only optional
- ssh option still can be used for forwarding as in sample config
Signed-off-by: kkubicki <krzysiek.kubicki@gmail.com>
PKG_NAME:=autossh
PKG_VERSION:=1.4g
PKG_NAME:=autossh
PKG_VERSION:=1.4g
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=https://www.harding.motd.ca/autossh/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=https://www.harding.motd.ca/autossh/
config_get path "$section" path
config_get pidfile "$section" pidfile
config_get path "$section" path
config_get pidfile "$section" pidfile
- if [ -z "$localport" ]; then
- echo "autossh: localport option is required"
+ if [ -n "$localport" ] && [ -n "$remoteport" ]; then
+ if [ -n "$remotehost" ]; then
+ forwarding="-L ${localport}:${remotehost}:${remoteport}"
+ else
+ forwarding="-R ${remoteport}:${localhost}:${localport}"
+ fi
+ elif [ -n "$localport" ] || [ -n "$remoteport" ]; then
+ echo "autossh: both localport and remoteport options are required"
- if [ -n "$remotehost" ]; then
- forwarding="-L ${localport}:${remotehost}:${remoteport}"
- else
- forwarding="-R ${remoteport}:${localhost}:${localport}"
- fi
-
procd_open_instance "$section"
procd_set_param command /usr/sbin/autossh ${forwarding} ${ssh}
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_open_instance "$section"
procd_set_param command /usr/sbin/autossh ${forwarding} ${ssh}
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}