You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
772 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2007-2011 OpenWrt.org
  3. USE_PROCD=1
  4. START=80
  5. start_instance() {
  6. local section="$1"
  7. config_get ssh "$section" 'ssh'
  8. config_get gatetime "$section" 'gatetime'
  9. config_get monitorport "$section" 'monitorport'
  10. config_get poll "$section" 'poll'
  11. config_get_bool enabled "$section" 'enabled' '1'
  12. [ "$enabled" = 1 ] || exit 0
  13. procd_open_instance
  14. procd_set_param command /usr/sbin/autossh -M ${monitorport:-20000} ${ssh}
  15. procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
  16. procd_set_param env AUTOSSH_GATETIME="${gatetime:-30}"
  17. procd_set_param env AUTOSSH_POLL="${poll:-600}"
  18. procd_close_instance
  19. }
  20. start_service() {
  21. config_load 'autossh'
  22. config_foreach start_instance 'autossh'
  23. }