-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_sites.sh
executable file
·106 lines (88 loc) · 2.21 KB
/
check_sites.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
set -e
function check_project
{
echo "---------------------------"
echo "site: $site"
rm -rf _site/
cargo run --bin code-maven -- web --root $site --outdir _site/
echo "---------------------------"
for full_path in _site/*.html
do
echo $full_path
page=$(basename $full_path)
echo $page
# don't expect to have a png file for pages that redirect
set +e
redirect=$(grep 'http-equiv="refresh"' $full_path)
set -e
if [ "$redirect" == "" ]
then
page=$(sed "s/html$/png/" <<< "$page")
echo _site/img/$page
test -f _site/img/$page
fi
done
}
function check_public_projects
{
for url in \
https://github.com/moshe742/my_blog \
https://github.com/szabgab/rust.code-maven.com \
https://github.com/szabgab/rust.org.il \
https://github.com/szabgab/banner-builder.rs \
https://github.com/szabgab/site-checker.rs
do
echo "Processing $url"
cd $root
folder=${url##*/}
echo "folder: $folder"
if [ -e .sites/$folder ]
then
echo "exists. git pull"
cd .sites/$folder
git pull
else
echo "git clone"
cd .sites
git clone $url
cd $folder
fi
cd $root
site=.sites/$folder
if [ "$folder" == "banner-builder.rs" ] || [ "$folder" == "site-checker.rs" ]
then
echo "site"
site=$site/site
fi
check_project
done
}
function check_private_projects
{
for project in izrael.szabgab.com israel.szabgab.com
do
echo "private project $project"
if [ -e ../$project ];
then
site=../$project
else
if [ -e .sites/$project ];
then
site=.sites/$project
else
echo skipping private site
continue
fi
fi
check_project
done
}
root=$(pwd)
echo "root=$root"
mkdir -p .sites
site=site
check_project
check_public_projects
check_private_projects
echo "-------------------------------"
echo Finished successfully