Created
October 2, 2017 09:32
-
-
Save alaniwi/e9186a8b9897c77b1fcc8adf8d25b6dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# create a copy of the ESGF mirror site, consisting of hard links | |
# | |
# make it in a temporary location, and if it succeeds, rename it | |
# to a dated directory under the webserver (outside of the main tree) | |
# | |
# otherwise, leaves it in tmp location to be cleaned up next time | |
# this cron job runs. | |
top=/path/to/htdocs | |
maindir=$top/esgf | |
snapdir=$top/esgf_snapshots | |
tmpcopy=$snapdir/.partial_copy | |
rm -fr $tmpcopy | |
cp -Ral $maindir $tmpcopy | |
status=$? | |
if [ $status -eq 0 ] | |
then | |
dest=$snapdir/`date +%Y%m%d` | |
if [ -e $dest ] ; then dest=$snapdir/`date +%Y%m%d_%H%M%S`; fi | |
mv $tmpcopy $dest | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script to make snapshots of esgf distribution on the rsync mirror sites.
Set the path in line 13, run daily from cron, and use script at https://gist.github.com/alaniwi/e9186a8b9897c77b1fcc8adf8d25b6dc to delete some older snapshots to reduce this to weekly.