[Mageia-sysadm] [165] - use mv -f instead of cp + rm ( shorter, cleaner )

root at mageia.org root at mageia.org
Fri Nov 5 19:46:09 CET 2010


Revision: 165
Author:   misc
Date:     2010-11-05 19:46:09 +0100 (Fri, 05 Nov 2010)
Log Message:
-----------
- use mv -f instead of cp + rm ( shorter, cleaner )
- move file creation later rather than creating it and removing it after 

Modified Paths:
--------------
    puppet/modules/blog/templates/check_new-blog-post.sh

Modified: puppet/modules/blog/templates/check_new-blog-post.sh
===================================================================
--- puppet/modules/blog/templates/check_new-blog-post.sh	2010-11-05 18:34:23 UTC (rev 164)
+++ puppet/modules/blog/templates/check_new-blog-post.sh	2010-11-05 18:46:09 UTC (rev 165)
@@ -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 @@
 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"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101105/419db9fc/attachment.html>


More information about the Mageia-sysadm mailing list