mirror of
https://github.com/YunoHost-Apps/syncserver-rs_ynh.git
synced 2024-09-03 20:26:32 +02:00
Fix backup and restore.
This commit is contained in:
parent
5ab8a32725
commit
ac656c0f20
2 changed files with 14 additions and 38 deletions
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
#### App file generated with YoloGen, the Yunohost app generator, version 0.6.5.
|
||||
# This is the tutorial version of the app.
|
||||
# It contains extra commands to explain what should be done in case you want to adjust some part of the script.
|
||||
# Once you are done, you may remove them.
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
@ -18,10 +15,6 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
|
||||
### to be backuped and not an actual copy of any file. The actual backup that
|
||||
### creates and fill the archive with the files happens in the core after this
|
||||
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -34,12 +27,6 @@ ynh_backup --src_path="$install_dir"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
|
@ -47,19 +34,12 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
|||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
ynh_backup --src_path="/etc/$app/"
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATABASE
|
||||
|
@ -70,6 +50,8 @@ ynh_print_info --message="Backing up the mysql database..."
|
|||
### copy of the generated dump to the archive still happens later)
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
ynh_mysql_dump_db --database="$db_name_tokenserver" > db_tokenserver.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
#### App file generated with YoloGen, the Yunohost app generator, version 0.6.5.
|
||||
# This is the tutorial version of the app.
|
||||
# It contains extra commands to explain what should be done in case you want to adjust some part of the script.
|
||||
# Once you are done, you may remove them.
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
@ -20,18 +17,22 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
# $install_dir will automatically be initialized with some decent
|
||||
# permission by default ... however, you may need to recursively reapply
|
||||
# ownership to all files such as after the ynh_setup_source step
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
#=================================================
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
ynh_script_progression --message="Restoring tokenserver database..." --weight=1
|
||||
ynh_mysql_create_db "$db_name_tokenserver" "$db_user" "$db_pwd"
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name_tokenserver < ./db_tokenserver.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -47,13 +48,6 @@ systemctl enable $app.service --quiet
|
|||
|
||||
yunohost service add $app --description="Firefox Sync Server (Rust)" --log="/var/log/$app/$app.log"
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
# Other various files...
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
ynh_restore_file --origin_path="/etc/$app/"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Add table
Reference in a new issue