From 38be4fe7e5d669bfd8655ae23da82a34198d8a31 Mon Sep 17 00:00:00 2001 From: Justin Clift Date: Sat, 21 Aug 2021 20:31:48 +1000 Subject: [PATCH] Shell script used on the nightly build server to move builds into subdirs Runs automatically from cron every month, on the 14th day of each month. It's pretty simple, but should do the job --- installer/other/move_nightlies_into_dirs.sh | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 installer/other/move_nightlies_into_dirs.sh diff --git a/installer/other/move_nightlies_into_dirs.sh b/installer/other/move_nightlies_into_dirs.sh new file mode 100755 index 00000000..b04f6b30 --- /dev/null +++ b/installer/other/move_nightlies_into_dirs.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Moving the nightly builds into appropriate subdirs. Designed to be +# run automatically from cron, using something like this: +# 10 0 14 * * /usr/local/bin/move_nightlies_into_dirs.sh + +# Retrieve the month number for last month +YEARMONTH=`date -d "last month 13:00" '+%Y-%m'` +YEARMONTHOSX=`date -d "last month 13:00" '+%Y%m'` + +# Create appropriate new subfolders +mkdir /nightlies/osx/${YEARMONTH} +mkdir /nightlies/win32/${YEARMONTH} +mkdir /nightlies/win64/${YEARMONTH} + +# Move builds +mv /nightlies/osx/DB*${YEARMONTHOSX}* /nightlies/osx/${YEARMONTH}/ +mv /nightlies/win32/DB*${YEARMONTH}* /nightlies/win32/${YEARMONTH}/ +mv /nightlies/win64/DB*${YEARMONTH}* /nightlies/win64/${YEARMONTH}/ + +# Fix ownership and context +chown -Rh nightlies: /nightlies/osx/${YEARMONTH} /nightlies/win32/${YEARMONTH} /nightlies/win64/${YEARMONTH} +restorecon -RFv /nightlies/osx/${YEARMONTH} /nightlies/win32/${YEARMONTH} /nightlies/win64/${YEARMONTH} + +echo Nightlies moved for $YEARMONTH