autossh.init 565 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2007-2011 OpenWrt.org
  3. START=80
  4. start_instance() {
  5. local section="$1"
  6. config_get ssh "$section" 'ssh'
  7. config_get gatetime "$section" 'gatetime'
  8. config_get monitorport "$section" 'monitorport'
  9. config_get poll "$section" 'poll'
  10. export AUTOSSH_GATETIME="${gatetime:-30}"
  11. export AUTOSSH_POLL="${poll:-600}"
  12. service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh}
  13. }
  14. boot() {
  15. return
  16. }
  17. start() {
  18. config_load 'autossh'
  19. config_foreach start_instance 'autossh'
  20. }
  21. stop() {
  22. service_stop /usr/sbin/autossh
  23. }