Add backup script and cron

This commit is contained in:
iFargle 2023-12-13 23:01:39 +09:00
parent c094d3c9b5
commit b6c66a99e2
2 changed files with 30 additions and 20 deletions

View file

@ -92,30 +92,30 @@ fi
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/Movies/ /mnt/$drive2/Movies/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/Movies/ /mnt/$drive2/Movies/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[L-M]* /mnt/$drive2/TV_Shows/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[L-M]* /mnt/$drive2/TV_Shows/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[F-M]* /mnt/$drive2/TV_Shows/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[F-M]* /mnt/$drive2/TV_Shows/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"
/bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/YouTube /mnt/$drive3/YouTube/${RESTORE}" /bin/echo -e "${LGREEN}rsync -avr --delete /Storage/Video/YouTube /mnt/$drive3/YouTube/${RESTORE}"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube/ /mnt/$drive3/YouTube/ /usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube/ /mnt/$drive3/YouTube/
/bin/echo -e "${PURPLE}================================================================================${RESTORE}" /bin/echo -e "${PURPLE}================================================================================${RESTORE}"
/bin/echo -e "${RED}======= Time: `date`${RESTORE}" /bin/echo -e "${RED}======= Time: `date`${RESTORE}"

View file

@ -0,0 +1,10 @@
{ pkgs, ... }: {
services.cron = {
enable = true;
systemCronJobs = [
# Backups from nuc-docker01 - See "backup-script.nix"
# https://git.sysctl.io/albert/random-scripts/src/branch/master/rsync-pi/rsync-all.sh
''0 0 * * * root rsync-backup''
];
};
}