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.

39 lines
1.2 KiB

  1. #!/bin/sh /etc/rc.common
  2. # Oct 2012, karlp@remake.is
  3. START=90
  4. APP=pagekitec
  5. USE_PROCD=1
  6. add_instance() {
  7. local cfg="$1"
  8. local kitename kitesecret simple_http simple_ssh simple_ws static
  9. config_get kitename "$cfg" kitename
  10. config_get kitesecret "$cfg" kitesecret
  11. [ -z "$kitename" -o -z "$kitesecret" ] && {
  12. echo "Both kitename and kitesecret must be specified"
  13. return 1
  14. }
  15. config_get_bool simple_http "$cfg" simple_http 0
  16. config_get_bool simple_ssh "$cfg" simple_ssh 0
  17. config_get simple_ws "$cfg" simple_ws 0
  18. config_get_bool static "$cfg" static 0
  19. procd_open_instance
  20. procd_set_param command $APP
  21. procd_append_param command -s
  22. procd_append_param command -Y json:/tmp/pagekite.status.json
  23. [ $static -eq 1 ] && procd_append_param command -S
  24. [ $simple_http -eq 1 ] && procd_append_param command 80 http $kitename 0 $kitesecret
  25. [ $simple_ssh -eq 1 ] && procd_append_param command 22 raw-22 $kitename 0 $kitesecret
  26. [ $simple_ws -gt 0 ] && procd_append_param command $simple_ws websocket-$simple_ws $kitename 0 $kitesecret
  27. procd_close_instance
  28. }
  29. start_service() {
  30. config_load pagekitec && config_foreach add_instance pagekitec
  31. }
  32. service_triggers()
  33. {
  34. procd_add_reload_trigger "pagekitec"
  35. }