2020-10-10 15:31:31 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
|
|
|
# keep the files in renew up to date with git repo
|
|
|
|
# this script will be called from a cronjob every 7 days
|
|
|
|
# cwalsh 2020-10-10
|
|
|
|
|
|
|
|
# ensure we are in the correct directory
|
2021-08-02 15:55:30 +00:00
|
|
|
cd /var/www/html/renew
|
2020-10-10 15:31:31 +00:00
|
|
|
|
2020-10-24 13:56:30 +00:00
|
|
|
# check the repo is available
|
|
|
|
git ls-remote http://github.com/ULCompSoc/skynet.ie-renew.git -q || { echo 'Repo not available' ; exit 1; }
|
|
|
|
|
2020-10-10 15:31:31 +00:00
|
|
|
# delete all files in directory except for this script
|
|
|
|
ls | grep -v update-renew-from-github.sh | xargs rm -rf --
|
|
|
|
|
|
|
|
# clone renew directory
|
|
|
|
git clone http://github.com/ULCompSoc/skynet.ie-renew.git
|
|
|
|
|
|
|
|
# copy files from git repo to main directory
|
|
|
|
cp -r skynet.ie-renew/* .
|
|
|
|
|
|
|
|
# remove the git repo from the directory
|
|
|
|
rm -rf skynet.ie-renew
|