/[adm]/puppet/modules/blog/templates/check_new-blog-post.sh
ViewVC logotype

Contents of /puppet/modules/blog/templates/check_new-blog-post.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 145 - (show annotations) (download) (as text)
Fri Nov 5 14:34:52 2010 UTC (13 years, 5 months ago) by dams
File MIME type: application/x-sh
File size: 1030 byte(s)
fix the mail address and message on blog
1 #!/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 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/cp $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old"
32 /bin/rm -rf $PATH_TO_FILE"/RSS_new"

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.30