Le Wiki de Tchack

Guides et documentation sur le serveur tchack.xyz

Outils pour utilisateurs

Outils du site


adminsys:script-save-auto-local

Script de sauvegarde locale par l'outil yunohost. Egalement posté sur https://paste.yunohost.org/ufonicacop.bash

Ce script n'est plus utilisé, il a été fusionné avec l'appel à BorgBackup.

script-local.bash
#!/bin/bash
 
#From  @djib https://forum.yunohost.org/t/sauvegardes-automatiques-a-j-1-j-7-et-j-30/6495
#Modified by @jaxom on 2018-12-19
#Licenced under GPL. https://www.gnu.org/licenses/gpl.html
 
#GOAL: Creates a backup and removes some of the previous backups
#HOWTO: call it via cron as frequently as you want
#The Nextcloud app is excluded from the backup due to its size. TODO : find how to save calendars and contacts but not the files.
 
 
# Backups are created with the following prefix
PREFIX="auto-"
# All backups with the previous prefix are deleted except the following dates
TODAY=`date '+%Y-%m-%d'`
LAST_WEEK=`date -d "7 days ago" '+%Y-%m-%d'`
BEGINNING_OF_MONTH=`date '+%Y-%m-01'`
BEGINNING_OF_LAST_MONTH=`date -d "last month" '+%Y-%m-01'`
 
#separation between apps and config
 
yunohost backup create -n $PREFIX$TODAY-core --system
yunohost backup create -n $PREFIX$TODAY-apps --apps `yunohost app list -i | grep id| sed 's/id: //' | sed 's/nextcloud//'`
 
#Removal of old backups
cd /home/yunohost.backup/archives
rm `ls | grep $PREFIX | grep -v "$TODAY\|$LAST_WEEK\|$BEGINNING_OF_MONTH\|$BEGINNING_OF_LAST_MONTH"`
 
#last line to check, useless in cron mode
#yunohost backup list
 
#Send an SMS notification using FreeMobileAPI
#curl --insecure "https://smsapi.free-mobile.fr/sendmsg?user=##REPLACEWITHYOURUSER##&pass=##REPLACEWITHYOURAPIKEY##&msg=AutoYNHBackup"
adminsys/script-save-auto-local.txt · Dernière modification : 2019/02/25 16:31 de jaxom