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

Remove timings for backup

This commit is contained in:
Jimmy Monin 2020-05-24 15:53:05 +02:00
parent 8832989ef4
commit 3772bf42fb

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -33,17 +33,26 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#=================================================
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.
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name="grafana-server" --action="stop" --log_path="/var/log/grafana/grafana.log" ynh_systemd_action --service_name="grafana-server" --action="stop" --log_path="/var/log/grafana/grafana.log"
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up configuration directories..." --weight=1 ynh_print_info --message="Backing up configuration directories..."
ynh_backup --src_path="/etc/influxdb" ynh_backup --src_path="/etc/influxdb"
ynh_backup --src_path="/etc/grafana" ynh_backup --src_path="/etc/grafana"
@ -52,22 +61,24 @@ ynh_backup --src_path="/var/lib/grafana/plugins"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 ynh_print_info --message="Backing up nginx web server configuration..."
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 MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backing up the MySQL database..." --weight=2 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 ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
ynh_script_progression --message="Backing up the InfluxDB database..." --weight=10 ynh_print_info --message="Backing up the InfluxDB database..."
# Backup InfluxDB data # Backup InfluxDB data
# Source: http://stackoverflow.com/questions/39501416/how-to-restore-data-base-using-influxd # Source: http://stackoverflow.com/questions/39501416/how-to-restore-data-base-using-influxd
mkdir influxdb_data mkdir influxdb_data
@ -80,7 +91,7 @@ fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name="grafana-server" --action="start" --log_path="/var/log/grafana/grafana.log" ynh_systemd_action --service_name="grafana-server" --action="start" --log_path="/var/log/grafana/grafana.log"
@ -88,4 +99,4 @@ ynh_systemd_action --service_name="grafana-server" --action="start" --log_path="
# 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)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."