From 8974a274b1169798dced09725fc98fb46d36a87a Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 5 Nov 2010 18:46:09 +0000 Subject: - use mv -f instead of cp + rm ( shorter, cleaner ) - move file creation later rather than creating it and removing it after --- modules/blog/templates/check_new-blog-post.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'modules/blog/templates/check_new-blog-post.sh') diff --git a/modules/blog/templates/check_new-blog-post.sh b/modules/blog/templates/check_new-blog-post.sh index 10081508..ea4d9904 100755 --- a/modules/blog/templates/check_new-blog-post.sh +++ b/modules/blog/templates/check_new-blog-post.sh @@ -3,16 +3,16 @@ # Initialization PATH_TO_FILE="/var/lib/blog" /usr/bin/wget -qO $PATH_TO_FILE"/RSS_new" http://blog.mageia.org/?feed=rss2 -/bin/date +"%d:%m:%Y %H:%M" > $PATH_TO_FILE"/last_check" # Check if RSS_old exists if [ ! -f $PATH_TO_FILE"/RSS_old" ] then - /bin/cp $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" - /bin/rm -rf $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/last_check" + /bin/mv -f $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" exit 1 fi +/bin/date +"%d:%m:%Y %H:%M" > $PATH_TO_FILE"/last_check" + # Check if a new blog post on EN needs to be translated on other blogs tmp_new=$(/bin/grep 'lastBuildDate' $PATH_TO_FILE"/RSS_new") tmp_old=$(/bin/grep 'lastBuildDate' $PATH_TO_FILE"/RSS_old") @@ -28,5 +28,4 @@ if [ "$tmp_old" = "$tmp_new" ] fi # Clean tmp files and copy RSS_new to RSS_old -/bin/cp $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" -/bin/rm -rf $PATH_TO_FILE"/RSS_new" +/bin/mv -f $PATH_TO_FILE"/RSS_new" $PATH_TO_FILE"/RSS_old" -- cgit v1.2.1