restore 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # checker service
  24. systemctl start "$service_checker_name"
  25. systemctl enable "$service_checker_name" --quiet
  26. systemctl start "$service_checker_name.timer"
  27. systemctl enable "$service_checker_name.timer" --quiet
  28. #=================================================
  29. # ADVERTISE SERVICE IN ADMIN PANEL
  30. #=================================================
  31. #=================================================
  32. # END OF SCRIPT
  33. #=================================================
  34. ynh_print_info "Restoration completed for $app"