1 |
#!/bin/sh |
2 |
|
3 |
# Initialization |
4 |
PATH_TO_FILE="/var/lib/blog" |
5 |
/usr/bin/wget -qO $PATH_TO_FILE"/RSS_new" http://blog.mageia.org/?feed=rss2 |
6 |
|
7 |
# Check if RSS_old exists |
8 |
if [ ! -f $PATH_TO_FILE"/RSS_old" ] |
9 |
then |
10 |
/bin/mv -f $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" |
11 |
exit 1 |
12 |
fi |
13 |
|
14 |
/bin/date +"%d:%m:%Y %H:%M" > $PATH_TO_FILE"/last_check" |
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 |
echo "A new blog post is waiting for translation" | /bin/mail -s "New entry on English Blog" mageia-blogteam@mageia.org |
27 |
echo $DATE |
28 |
fi |
29 |
|
30 |
# Clean tmp files and copy RSS_new to RSS_old |
31 |
/bin/mv -f $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" |