generated from YunoHost/example_ynh
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbackup
executable file
·52 lines (37 loc) · 1.77 KB
/
backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
ynh_print_info "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 fills the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls take basically 0 seconds to run.
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Backup the systemd service unit
ynh_backup "/etc/systemd/system/$app.service"
# Backup the logrotate configuration
ynh_backup "/etc/logrotate.d/$app"
# Backup the Fail2Ban config
# ynh_backup "/etc/fail2ban/jail.d/$app.conf"
# ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
# NB: /var/log is not backuped during safety-backup-before-upgrades, same as $data_dir
ynh_backup "/var/log/$app/"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."