commit c4575a6567677f2c7536e6f000dbb47895d597bc
parent 081213cdf65676a9eb0b56ffd804463fb894f000
Author: sin <sin@2f30.org>
Date: Wed, 27 Nov 2013 11:26:53 +0000
Cleanup after SIGTERM and remove tmp file on errors
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/itor b/itor
@@ -14,10 +14,11 @@ mkdir -p $ldir
listing=$(mktemp)
-trap 'rm -f $listing; exit 0' 2
+trap 'rm -f $listing; exit 0' 2 15
ssh $host "ls $rdir" > $listing
if [ ! $? -eq 0 ]; then
+ rm $listing
exit 1
fi
@@ -28,6 +29,7 @@ while read f; do
done < $listing
if [ $idx -eq 0 ]; then
+ rm $listing
echo "No files to serve"
exit 0
fi