From 0f62de411ad9f6c45741836e68a00a140bf5183e Mon Sep 17 00:00:00 2001 From: Jeremy Olexa Date: Tue, 14 Sep 2010 19:36:33 +0000 Subject: Use cp -a, check for year dir before copying --- scripts/update-venus | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/update-venus b/scripts/update-venus index 04165f6..62d3eed 100755 --- a/scripts/update-venus +++ b/scripts/update-venus @@ -40,8 +40,11 @@ rm -f ${BASE_DIR}generated_configs/venus.{planet,universe}.ini # Delete old logs find ${BASE_DIR}logs -type f -mtime +30 -delete -# Archive posts -cp ${BASE_DIR}htdocs/index.html \ +# Check for year directory, if not there create both needed +[[ -d ${BASE_DIR}htdocs/archives/$(date +%G) ]] || \ + mkdir ${BASE_DIR}htdocs/{,universe/}archives/$(date +%G) +# Archive posts, use -a to retain readable permissions +cp -a ${BASE_DIR}htdocs/index.html \ ${BASE_DIR}htdocs/archives/$(date +%G)/${DATE}.html -cp ${BASE_DIR}htdocs/universe/index.html \ +cp -a ${BASE_DIR}htdocs/universe/index.html \ ${BASE_DIR}htdocs/universe/archives/$(date +%G)/${DATE}.html -- cgit v1.2.3-65-gdbad