diff options
author | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:03:25 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:03:25 +0200 |
commit | e573b3020c032400eed60b649a2cbf55266e6bb0 (patch) | |
tree | 8f572394ac8433529c7a8e70d160a2fbe8268b4e /config/i3blocks/scripts/backup | |
parent | b8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff) | |
download | myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2 myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip |
Add current configurations from old repository
Diffstat (limited to 'config/i3blocks/scripts/backup')
-rwxr-xr-x | config/i3blocks/scripts/backup | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/config/i3blocks/scripts/backup b/config/i3blocks/scripts/backup new file mode 100755 index 0000000..24b3954 --- /dev/null +++ b/config/i3blocks/scripts/backup @@ -0,0 +1,47 @@ +#!/bin/bash + +if [[ -n "$BLOCK_BUTTON" ]]; then + nohup urxvt -title "System backup" -hold -e sudo system-backup 2>&1 >/dev/null & +fi + +state=5 +if [[ -e ~/.backup_date ]]; then + today=$(date +"%Y%m%d") + prev=$(date -d `cat ~/.backup_date` +"%Y%m%d") + dif=$(expr $today - $prev) + if [[ $dif -ge 30 ]]; then + state=4 + elif [[ $dif -ge 20 ]]; then + state=3 + elif [[ $dif -ge 5 ]]; then + state=2 + elif [[ $dif -ge 2 ]]; then + state=1 + else + state=0 + fi +fi + +if [[ $state -eq 0 ]]; then + exit 0 +fi + +echo "Do backup" +echo "Backup" +case $state in + 1) + echo + ;; + 2) + echo "#ffff00" + ;; + 3) + echo "#ff8a00" + ;; + 4) + echo "#ff5000" + ;; + 5) + echo "#ff0000" + ;; +esac |