1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-sysadm] [165] - use mv -f instead of cp + rm ( shorter, cleaner )
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B165%5D%20-%20use%20mv%20-f%20instead%20of%20cp%20%2B%20rm%20%28%20shorter%2C%0A%09cleaner%20%29&In-Reply-To=%3C20101105184609.6588B3FBF8%40valstar.mageia.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000286.html">
<LINK REL="Next" HREF="000288.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [165] - use mv -f instead of cp + rm ( shorter, cleaner )</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B165%5D%20-%20use%20mv%20-f%20instead%20of%20cp%20%2B%20rm%20%28%20shorter%2C%0A%09cleaner%20%29&In-Reply-To=%3C20101105184609.6588B3FBF8%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [165] - use mv -f instead of cp + rm ( shorter, cleaner )">root at mageia.org
</A><BR>
<I>Fri Nov 5 19:46:09 CET 2010</I>
<P><UL>
<LI>Previous message: <A HREF="000286.html">[Mageia-sysadm] [164] - migrate to the new config file format
</A></li>
<LI>Next message: <A HREF="000288.html">[Mageia-sysadm] [166] - enable reporting, as explained on http://projects.puppetlabs.com/ projects/1/wiki/Reports_And_Reporting
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#287">[ date ]</a>
<a href="thread.html#287">[ thread ]</a>
<a href="subject.html#287">[ subject ]</a>
<a href="author.html#287">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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" <A HREF="http://blog.mageia.org/?feed=rss2">http://blog.mageia.org/?feed=rss2</A>
-/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>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000286.html">[Mageia-sysadm] [164] - migrate to the new config file format
</A></li>
<LI>Next message: <A HREF="000288.html">[Mageia-sysadm] [166] - enable reporting, as explained on http://projects.puppetlabs.com/ projects/1/wiki/Reports_And_Reporting
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#287">[ date ]</a>
<a href="thread.html#287">[ thread ]</a>
<a href="subject.html#287">[ subject ]</a>
<a href="author.html#287">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>
|