projects
/
chef.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a7fa5f5
)
Use trap to release lock
author
Matt Amos
<zerebubuth@gmail.com>
Sun, 21 Dec 2014 17:21:24 +0000
(17:21 +0000)
committer
Tom Hughes
<tom@compton.nu>
Mon, 22 Dec 2014 14:28:20 +0000
(14:28 +0000)
cookbooks/planet/templates/default/planetdump.erb
patch
|
blob
|
history
diff --git
a/cookbooks/planet/templates/default/planetdump.erb
b/cookbooks/planet/templates/default/planetdump.erb
index 068ce5d5fd09d0f0d85d14ac1cd1311af506382c..4d5bac02ce64c61e90de2214ab8a8f828b3dfb1e 100644
(file)
--- a/
cookbooks/planet/templates/default/planetdump.erb
+++ b/
cookbooks/planet/templates/default/planetdump.erb
@@
-26,6
+26,14
@@
fi
# Create Lock
echo $$ > /tmp/planetdump.lock
+function cleanup {
+ # Release lock
+ rm /tmp/planetdump.lock
+}
+
+# Remove lock on exit
+trap cleanup EXIT
+
# Change to working directory
cd /store/planetdump
@@
-56,6
+64,3
@@
do
md5sum "#{file}" > "#{file}.md5"
mv "${file}" "${file}.md5" "/store/planet/pbf"
done
-
-# Release lock
-rm /tmp/planetdump.lock