mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
da4f6c8ff7
Backup compress may fail due to improper tar cmd. Issue #51 Reference: https://stackoverflow.com/questions/20318852/tar-file-changed-as-we-read-it
45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
#!/bin/bash
|
|
set -eu
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source /usr/share/yunohost/helpers
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
#=================================================
|
|
# STANDARD BACKUP STEPS
|
|
#=================================================
|
|
# BACKUP THE APP MAIN DIR
|
|
#=================================================
|
|
|
|
workdir=$(pwd)
|
|
cd $final_path
|
|
backupfile="rocket.chat.gtar"
|
|
touch $backupfile
|
|
tar --exclude=$backupfile -czvf $workdir/$backupfile .
|
|
cd $workdir
|
|
ynh_backup ./$backupfile
|
|
|
|
#=================================================
|
|
# BACKUP THE CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_backup "/etc/systemd/system/$app.service" "conf/service"
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx"
|
|
|
|
#=================================================
|
|
# BACKUP THE MONGODB DATABASE
|
|
#=================================================
|
|
|
|
sudo mongodump -o "./dump"
|