Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
docs:guide-user:services:ssh:autossh [2022/03/25 10:46] – [Run as Service] trendydocs:guide-user:services:ssh:autossh [2022/03/25 10:50] – [Run as Service] trendy
Line 49: Line 49:
  
  
-        local section="$1" +        start_instance() { 
-        config_get ssh "$section" 'ssh' +                local section="$1" 
-        config_get gatetime "$section" 'gatetime' +         
-        config_get monitorport "$section" 'monitorport' +                config_get ssh "$section" 'ssh' 
-        config_get poll "$section" 'poll' +                config_get gatetime "$section" 'gatetime' 
-        config_get_bool enabled "$section" 'enabled' '1' +                config_get monitorport "$section" 'monitorport' 
-        [ "$enabled" = 1 ] || exit 0 +                config_get poll "$section" 'poll' 
-        export HOME=/root +                config_get_bool enabled "$section" 'enabled' '1' 
-        export AUTOSSH_GATETIME="${gatetime:-30}" +                 
-        export AUTOSSH_POLL="${poll:-600}" +                [ "$enabled" = 1 ] || exit 0 
-        export AUTOSSH_DEBUG=+                 
-        service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh}+                procd_open_instance 
 +                procd_set_param command /usr/sbin/autossh -M ${monitorport:-20000} ${ssh} 
 +                procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} 
 +                procd_set_param env AUTOSSH_GATETIME="${gatetime:-30}"  
 +                procd_set_param env AUTOSSH_POLL="${poll:-600}" 
 +                procd_set_param env HOME="/root" 
 +                procd_close_instance 
  
 Now you can enable the service by ''/etc/init.d/autossh enable'' and enjoy it. Now you can enable the service by ''/etc/init.d/autossh enable'' and enjoy it.
  • Last modified: 2023/11/30 22:27
  • by stokito