restore 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. source ../settings/scripts/_common.sh
  3. source /usr/share/yunohost/helpers
  4. #=================================================
  5. # RESTORE THE APP MAIN DIR
  6. #=================================================
  7. ynh_print_info "Restoring the app files..."
  8. ynh_restore
  9. #=================================================
  10. # RESTORE SYSTEMD
  11. #=================================================
  12. ynh_print_info "Restoring the systemd configuration..."
  13. systemctl daemon-reload
  14. # Set default inits
  15. # The boot order of these services are important, so they are disabled by default
  16. # and the vpnclient service handles them.
  17. systemctl disable openvpn --quiet
  18. systemctl stop openvpn
  19. # main service
  20. yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log"
  21. yunohost service enable "$service_name"
  22. ynh_use_logrotate --logfile="/var/log/ynh-vpnclient.log"
  23. ynh_use_logrotate --logfile="/var/log/openvpn-client.log"
  24. # checker service
  25. systemctl start "$service_checker_name"
  26. systemctl enable "$service_checker_name" --quiet
  27. systemctl start "$service_checker_name.timer"
  28. systemctl enable "$service_checker_name.timer" --quiet
  29. #=================================================
  30. # ADVERTISE SERVICE IN ADMIN PANEL
  31. #=================================================
  32. #=================================================
  33. # END OF SCRIPT
  34. #=================================================
  35. ynh_print_info "Restoration completed for $app"