dwmb-backups (532B) - raw


      1 #!/bin/sh
      2 
      3 outfile="/home/oscar/.local/share/backups"
      4 
      5 if [ ! -f "$outfile" ]; then
      6     lastdate="0"
      7     lasterr="0"
      8 else
      9     tmp="$(cat "$outfile")"
     10     lastdate="${tmp%% *}"
     11     lasterr="${tmp##* }"
     12 fi
     13 
     14 if [ "$(date --date="12 hours ago" +%s)" -ge "$lastdate" ]; then
     15     echo ""
     16     restic-daily > /dev/null &
     17     exit 0
     18 else
     19     if [ "$lasterr" = "0" ]; then
     20         exit 0
     21     elif [ "$lasterr" = "2" ] && [ "$lastdate" -ge "$(date --date="20 mins ago" +%s)" ]; then
     22         echo ""
     23     else
     24         echo ""
     25     fi
     26 fi