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.

40 lines
808 B

  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. STOP=01
  4. USE_PROCD=1
  5. PROG=/usr/bin/flask
  6. start_service() {
  7. . /lib/functions/postgresql.sh
  8. local pgdata=$(uci get postgresql.config.PGDATA)
  9. local i=0
  10. while ! pg_server_ready "$pgdata"; do
  11. sleep 1
  12. [ $((i++)) -gt 30 ] && return 1
  13. done
  14. i=0
  15. while ! pg_test_db asu asu; do
  16. sleep 1
  17. [ $((i++)) -gt 30 ] && return 1
  18. done
  19. FLASK_APP=asu $PROG loaddb
  20. procd_open_instance asu_main
  21. procd_set_param user asu
  22. procd_set_param group asu
  23. procd_set_param command gunicorn asu:app
  24. procd_close_instance
  25. procd_open_instance main_worker
  26. procd_set_param user asu
  27. procd_set_param group asu
  28. procd_set_param env FLASK_APP=asu
  29. procd_set_param command $PROG run_worker
  30. procd_close_instance
  31. }