1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
gogs_ynh/scripts/backup

65 lines
2 KiB
Text
Raw Normal View History

2016-08-15 15:38:50 +02:00
#!/bin/bash
2018-02-08 17:25:54 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
2020-10-11 23:46:18 +02:00
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
2016-08-15 15:38:50 +02:00
2018-02-08 17:25:54 +01:00
#=================================================
2020-10-11 23:46:18 +02:00
# BACKUP THE APP MAIN DIR
2018-02-08 17:25:54 +01:00
#=================================================
2022-11-04 22:02:19 +01:00
ynh_backup --src_path="$install_dir"
2016-08-15 15:38:50 +02:00
2021-11-07 09:17:22 +01:00
#=================================================
# BACKUP THE DATA DIR
#=================================================
2022-11-04 22:02:19 +01:00
ynh_backup --src_path="$data_dir" --is_big
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
2020-12-06 14:40:38 +01:00
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2020-10-11 23:46:18 +02:00
#=================================================
2021-11-06 19:10:24 +01:00
# BACKUP LOGROTATE
2020-10-11 23:46:18 +02:00
#=================================================
2021-11-06 19:10:24 +01:00
ynh_backup --src_path="/etc/logrotate.d/$app"
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
2021-11-06 19:10:24 +01:00
# BACKUP SYSTEMD
2020-10-11 23:46:18 +02:00
#=================================================
2021-11-06 19:10:24 +01:00
ynh_backup --src_path="/etc/systemd/system/$app.service"
2018-02-08 11:42:15 +01:00
2020-12-30 15:07:15 +01:00
#=================================================
2021-11-06 19:10:24 +01:00
# BACKUP VARIOUS FILES
2020-12-30 15:07:15 +01:00
#=================================================
2021-11-06 19:10:24 +01:00
ynh_backup --src_path="/var/log/$app"
2020-12-30 15:07:15 +01:00
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."