1 |
dams |
143 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
# Initialization |
4 |
|
|
PATH_TO_FILE="/home/blog" |
5 |
|
|
/usr/bin/wget -qO $PATH_TO_FILE"/RSS_new" http://blog.mageia.org/?feed=rss2 |
6 |
|
|
/bin/date +"%d:%m:%Y %H:%M" > $PATH_TO_FILE"/last_check" |
7 |
|
|
|
8 |
|
|
# Check if RSS_old exists |
9 |
|
|
if [ ! -f $PATH_TO_FILE"/RSS_old" ] |
10 |
|
|
then |
11 |
|
|
/bin/cp $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" |
12 |
|
|
/bin/rm -rf $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/last_check" |
13 |
|
|
exit 1 |
14 |
|
|
fi |
15 |
|
|
|
16 |
|
|
# Check if a new blog post on EN needs to be translated on other blogs |
17 |
|
|
tmp_new=$(/bin/grep 'lastBuildDate' $PATH_TO_FILE"/RSS_new") |
18 |
|
|
tmp_old=$(/bin/grep 'lastBuildDate' $PATH_TO_FILE"/RSS_old") |
19 |
|
|
if [ "$tmp_old" = "$tmp_new" ] |
20 |
|
|
then |
21 |
|
|
# Nothing new |
22 |
|
|
echo "NO" >> $PATH_TO_FILE"/last_check" |
23 |
|
|
else |
24 |
|
|
# New post to translate |
25 |
|
|
echo "YES" >> $PATH_TO_FILE"/last_check" |
26 |
dams |
145 |
echo "A new blog post is waiting for translation" /bin/mail -s "New entry on English Blog" mageia-blogteam@mageia.org |
27 |
dams |
143 |
echo $DATE |
28 |
|
|
fi |
29 |
|
|
|
30 |
|
|
# Clean tmp files and copy RSS_new to RSS_old |
31 |
|
|
/bin/cp $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" |
32 |
|
|
/bin/rm -rf $PATH_TO_FILE"/RSS_new" |