mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
[fix] Timers are not supported by yunohost
This commit is contained in:
parent
309d2fbc7b
commit
d5ae901aac
5 changed files with 18 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue