root@rpi-iot-jsho-cam-02:~# vi BackupModus.sh #!/bin/bash #FileName: BackupModus.sh #crontab: 59 23 * * * /root/BackupModus.sh set -x
BackupDay=`date „+%Y-%m-%d“` sleep 120
LocalBackupPath=“/var/lib/motioneye“
if [[ -d /Backup/BackupDay ]] ; then rm -rf /Backup/BackupDay ; fi if [[ ! -d /Backup/BackupDay/$BackupDay ]] ; then mkdir -p /Backup/BackupDay/$BackupDay ; fi
cd $LocalBackupPath tar cvf /Backup/BackupDay/$BackupDay/$BackupDay.tar */$BackupDay
BackupOption=“day“ if [ `date „+%u“` == „1“ ]; then BackupOption=“week“ ; fi if [ `date „+%d“` == „01“ ]; then BackupOption=“month“ ; fi if [ `date „+%m.%d“` == „01.01“ ]; then BackupOption=“year“ ; fi