1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osjs_ynh.git synced 2024-09-03 19:56:11 +02:00

Create restore

This commit is contained in:
frju365 2017-04-16 20:57:10 +02:00 committed by GitHub
parent 799529c833
commit 8ecd4f469a

36
scripts/restore Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash
set -eu
# Récupère les infos de l'application.
app=$YNH_APP_INSTANCE_NAME
# Source app helpers
source /usr/share/yunohost/helpers
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
# The parameter $1 is the uncompressed restore directory location
backup_dir=$1/apps/$app
# Restore sources & data
sudo cp -a $backup_dir/sources/. $final_path
# Restore Nginx and YunoHost parameters
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo apt-get update
sudo apt-get install npm nodejs nodejs-legacy -qy
# Restauration des fichiers du script systemd
sudo cp -a $backup_dir/${app}.service /etc/systemd/system/${app}.service
## Démarrage auto du service
sudo systemctl enable ${app}.service
# Restart webserver
sudo service nginx reload
# Start scrumblr
sudo service $app start