1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zwiicms_ynh.git synced 2024-09-03 18:06:04 +02:00

Update from example_ynh

This commit is contained in:
pp-r 2021-02-14 12:38:49 +01:00 committed by GitHub
parent 7b462c8cb1
commit babe93c073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,55 +24,46 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
# STOP SYSTEMD SERVICE ynh_print_info --message="Declaring files to be backed up..."
#=================================================
#ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
#ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ### 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 # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
#ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1
#ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# BACKUP FAIL2BAN CONFIGURATION # BACKUP FAIL2BAN CONFIGURATION
#================================================= #=================================================
#ynh_script_progression --message="Backing up fail2ban configuration..." --time --weight=1
#ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" #ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
#ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
@ -82,32 +73,35 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
#ynh_script_progression --message="Backing up logrotate configuration..." --time --weight=1
#ynh_backup --src_path="/etc/logrotate.d/$app" #ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
#ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
#ynh_backup --src_path="/etc/systemd/system/$app.service" #ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP A CRON FILE # BACKUP VARIOUS FILES
#================================================= #=================================================
#ynh_backup --src_path="/etc/cron.d/$app" #ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #ynh_backup --src_path="/etc/$app/"
# START SYSTEMD SERVICE
#=================================================
#ynh_script_progression --message="Starting a systemd service..." --time --weight=1
#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
#ynh_print_info --message="Backing up the MySQL database..."
### (However, things like MySQL dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)
#ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."