-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathserver_update
executable file
·44 lines (39 loc) · 1.24 KB
/
server_update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/sh
# Run this on the server. For example to run it every 5 minutes, put this into
# your crontab using "crontab -e" (adjust the path to the script):
#
# */5 * * * * ~/repos/planet.sympy.org/server_update >> cron_log 2>&1
#
# This will run the server_update script and save all output to cron_log (in
# your home directory).
#
# This script (server_update) first updates the master branch using "git pull",
# then it runs the "./update" script to regenerate the pages + gh-pages branch,
# then it pushes gh-pages back using "git push".
set -e
echo "----------------------------------"
echo "'server_update' started"
echo "Date:"
date
echo
# Find the directory this script is in:
ROOT=`readlink -n "$0" 2> /dev/null` || \
ROOT=`realpath "$0" 2> /dev/null` || \
ROOT="$0"
ROOT="${ROOT%/*}/"
cd "$ROOT"
echo "Updating the planet.sympy.org repository master with latest updates"
git pull origin master
echo " Done."
echo "Updating the gh-pages branch"
git fetch origin +gh-pages:gh-pages
echo " Done."
echo "Running './update'"
./update
echo "'./update' finished"
echo "Running 'git push origin gh-pages'"
git push origin gh-pages
echo "'git push origin gh-pages' finished"
echo
echo "'server_update' finished"
echo "----------------------------------"