From d5ae901aac4e65ba4558725050a4e4751a76d057 Mon Sep 17 00:00:00 2001 From: ljf Date: Sun, 25 Nov 2018 23:21:20 +0100 Subject: [PATCH] [fix] Timers are not supported by yunohost --- conf/backup_method.j2 | 8 ++++---- manifest.json | 2 +- scripts/install | 8 +++++--- scripts/restore | 8 +++++--- scripts/upgrade | 3 +++ 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/conf/backup_method.j2 b/conf/backup_method.j2 index 1ea3cde..dedbdb0 100644 --- a/conf/backup_method.j2 +++ b/conf/backup_method.j2 @@ -29,13 +29,13 @@ do_backup() { pushd $work_dir set +e if borg init -e repokey $repo >> $LOGFILE 2>> $ERRFILE; then - human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'` + #human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'` # Speed in Kbps - speed=1000 - evaluated_time=$(($size / ($speed * 1000 / 8) / 3600)) + #speed=1000 + #evaluated_time=$(($size / ($speed * 1000 / 8) / 3600)) echo "Hello, -Your first backup on $repo is starting. The backup size is evaluated to $human_size. If connectivity is 1Mbps between the 2 servers, it will take about $evaluated_time hour(s) to transmit. +Your first backup on $repo is starting. This is an automated message from your beloved YunoHost server." | /usr/bin/mail.mailutils -a "Content-Type: text/plain; charset=UTF-8" -s "[YNH] First backup is starting" "root" fi diff --git a/manifest.json b/manifest.json index cb84099..6ce468a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server with borg.", "fr": "Sauvegarder votre serveur avec borg." }, - "version": "1.0.1", + "version": "1.0.2", "url": "https://borgbackup.readthedocs.io", "license": "BSD-3-Clause", "maintainer": { diff --git a/scripts/install b/scripts/install index 6d0cad5..d009fab 100755 --- a/scripts/install +++ b/scripts/install @@ -70,9 +70,11 @@ ynh_configure backup-with-borg "/usr/local/bin/backup-with-$app" chmod u+x "/usr/local/bin/backup-with-$app" ynh_add_systemd_config ynh_configure systemd.timer "/etc/systemd/system/$app.timer" -yunohost service add $app.timer -yunohost service enable $app.timer -yunohost service start $app.timer +systemctl enable $app.timer +systemctl start $app.timer +#yunohost service add $app.timer +#yunohost service enable $app.timer +#yunohost service start $app.timer #================================================= # GENERATE SSH KEY diff --git a/scripts/restore b/scripts/restore index 8b76574..314bce0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -57,9 +57,11 @@ ynh_restore # ADVERTISE SERVICE IN ADMIN PANEL #================================================= yunohost service add $app -yunohost service add $app.timer -yunohost service enable $app.timer -yunohost service start $app.timer +systemctl enable $app.timer +systemctl start $app.timer +#yunohost service add $app.timer +#yunohost service enable $app.timer +#yunohost service start $app.timer #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index a2f1c92..ea436f8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,3 +33,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +yunohost service remove $app.timer +systemctl enable $app.timer +systemctl start $app.timer