change_url 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. ## this script is only run if actual change to domain/path is detected, if you're here either $domain or $path changed
  3. ## new location is available via $domain and $path (or $new_domain and $new_path variables if you want to be explicit)
  4. ## old values are available via, you guessed it, $old_domain and $old_path
  5. #=================================================
  6. # IMPORT GENERIC HELPERS
  7. #=================================================
  8. source _common.sh
  9. source /usr/share/yunohost/helpers
  10. #=================================================
  11. # STOP SYSTEMD SERVICE
  12. #=================================================
  13. ynh_script_progression "Stopping $app's systemd service..."
  14. ynh_systemctl --service="$app" --action="stop"
  15. #=================================================
  16. # MODIFY URL IN NGINX CONF
  17. #=================================================
  18. ynh_script_progression "Updating NGINX web server configuration..."
  19. # this will most likely adjust NGINX config correctly
  20. ynh_config_change_url_nginx
  21. #=================================================
  22. # SPECIFIC MODIFICATIONS
  23. #=================================================
  24. ## do any changes to files that reference specific installation domain/path, i.e. regenerate configs etc
  25. #=================================================
  26. # START SYSTEMD SERVICE
  27. #=================================================
  28. ynh_script_progression "Starting $app's systemd service..."
  29. ynh_systemctl --service="$app" --action="start"
  30. #=================================================
  31. # END OF SCRIPT
  32. #=================================================
  33. ynh_script_progression "Change of URL completed for $app"