35 lines
1.9 KiB
Bash
35 lines
1.9 KiB
Bash
#!/bin/bash
|
|||
|
|
date="$(date +"%m%d%H")"
|
||
|
|
echo "Start Backup" > /home/lucas/logs/log_backup_$date.log
|
||
|
|
find /home/lucas/logs/log_backup_* -mtime +12 -type f -delete
|
||
|
|
STARTTIME=$(date +"%T")
|
||
|
|
echo "Starttime: $STARTTIME"
|
||
|
|
sleep 2
|
||
|
|
BACKUP_CAL=true
|
||
|
|
SERVER="https://cloud.someoneslinux.selfhost.eu"
|
||
|
|
TIMESTAMP=$(date +"%Y%m%d")
|
||
|
|
BACKUP_DIR="/backup/dav"
|
||
|
|
|
||
|
|
find ${BACKUP_DIR}/backup_calender_* -mtime +31 -type f -delete
|
||
|
|
backup_cal_OC="${BACKUP_DIR}/backup_calender_NC_$TIMESTAMP.ics"
|
||
|
|
backup_cal_geb="${BACKUP_DIR}/backup_calender_geb_$TIMESTAMP.ics"
|
||
|
|
backup_cal_home="${BACKUP_DIR}/backup_calender_home_$TIMESTAMP.ics"
|
||
|
|
|
||
|
|
curl -s --netrc-file /home/lucas/.netrc -o "$backup_cal_OC" "${SERVER}/remote.php/dav/public-calendars/JtMqiXpm6mdM3yWC/?export"
|
||
|
|
if [ $? -eq 0 ]; then CAL_RET1="nextCloud Calender backup Successfull"; fi
|
||
|
|
curl -s --netrc-file /home/lucas/.netrc -o "$backup_cal_geb" "${SERVER}/remote.php/dav/public-calendars/gzxSDCXdWqj8MSMP/?export"
|
||
|
|
if [ $? -eq 0 ]; then CAL_RET2="Geburtstags Calender backup Successfull"; fi
|
||
|
|
curl -s --netrc-file /home/lucas/.netrc -o "$backup_cal_home" "${SERVER}/remote.php/dav/public-calendars/gkx3W9Cpk3eK2W62/?export"
|
||
|
|
if [ $? -eq 0 ]; then CAL_RET3="Haushalts Calender backup Successfull"; fi
|
||
|
|
|
||
|
|
find ${BACKUP_DIR}/backup_contacts_* -mtime +31 -type f
|
||
|
|
|
||
|
|
backup_contacts_phone="${BACKUP_DIR}/backup_contacts_ContactsPhone_$TIMESTAMP.vcf"
|
||
|
|
backup_email_addr="${BACKUP_DIR}/backup_contacts_EmailAddressen_$TIMESTAMP.vcf"
|
||
|
|
|
||
|
|
curl -s --netrc-file /home/lucas/.netrc -o "$backup_contacts_phone" "${SERVER}/remote.php/dav/addressbooks/users/syncuser/phonecontacts_shared_by_lucas?export"
|
||
|
|
if [ $? -eq 0 ]; then CON_RET1="nextCloud Contacts Phone backup Successfull"; fi
|
||
|
|
curl -s --netrc-file /home/lucas/.netrc -o "$backup_email_addr" "${SERVER}/remote.php/dav/addressbooks/users/syncuser/emailcontacts_shared_by_lucas?export"
|
||
|
|
if [ $? -eq 0 ]; then CON_RET2="NextCloud Contacts Email backup Successfull"; fi
|
||
|
|
|
||
|
|
echo "Endtime: $(date +"%T")"
|