yunohost_demo/demo_upgrade.sh

33 lines
1.3 KiB
Bash
Raw Normal View History

2016-08-12 17:35:14 +02:00
#!/bin/bash
2016-08-13 01:08:44 +02:00
# Script d'upgrade des 2 conteneurs de demo.
# Ce script n'a vocation qu'a être dans un cron
2016-08-12 17:35:14 +02:00
# Récupère le dossier du script
2016-09-18 19:23:54 +02:00
if [ "${0:0:1}" == "/" ]; then script_dir="$(dirname "$0")"; else script_dir="$(echo $PWD/$(dirname "$0" | cut -d '.' -f2) | sed 's@/$@@')"; fi
2022-10-13 05:46:46 +02:00
source $script_dir/ynh_lxd
source $script_dir/ynh_lxd_demo
source /usr/share/yunohost/helpers
app=${__APP__:-yunohost_demo}
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1)
lxc_name2=$(ynh_app_setting_get --app=$app --key=lxc_name2)
time_to_switch=$(ynh_app_setting_get --app=$app --key=time_to_switch)
IP_UPGRADE=$lxdbr_demo_network.150
2016-08-18 12:08:01 +02:00
LOOP=0
2016-08-13 22:05:38 +02:00
2022-10-13 05:46:46 +02:00
log_line=$(wc -l "$final_path/demo_upgrade.log" | cut -d ' ' -f 1) # Repère la fin du log actuel. Pour récupérer les lignes ajoutées sur cette exécution.
2016-09-18 19:23:54 +02:00
log_line=$(( $log_line + 1 )) # Ignore la première ligne, reprise de l'ancien log.
2022-10-13 05:46:46 +02:00
date >> "$final_path/demo_upgrade.log"
2016-08-12 17:35:14 +02:00
2022-10-13 05:46:46 +02:00
ynh_print_info --message="Starting upgrade..."
2016-11-24 13:49:11 +01:00
date
2022-10-13 05:46:46 +02:00
ynh_lxc_upgrade_demo --name=$lxc_name1 --time_to_switch=$time_to_switch
ynh_lxc_upgrade_demo --name=$lxc_name2 --time_to_switch=$time_to_switch
ynh_print_info --message="Upgrade finished..."