blob: 24b3954ca5bbc611b7fb89fe818a7f78cec24cf0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
|