Created
September 4, 2014 08:08
-
-
Save ilyaevseev/81db6254d906dd4df4b0 to your computer and use it in GitHub Desktop.
Backup changed data to remote Mercurial repositories -- /etc/cron.daily/push2mercurial skeleton.
This file contains hidden or 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 | |
WEBAPP_BASEDIR="/home/webapp" | |
HGSERVER_URI="http://webserv1:[email protected]:5000" | |
Push0() { | |
local o="/tmp/$2.log" | |
local e="/tmp/$2.err" | |
( | |
cd "$1" | |
hg status | grep -q '' || return | |
#echo "$1 updated" | |
hg addremove | |
hg commit -m "Periodic autocommit $(LANG=C date +%Y.%m.%d_%H:%M:%S)" | |
hg push "$HGSERVER_URI/$2" | |
) >"$o" 2>"$e" | |
test -s "$e" || { rm "$e"; return; } | |
cat $o $e | mail -s "push2mercurial: $1 to $2 failed." admins | |
} | |
Push() { Push "$WEBAPP_BASEDIR/$1" "$2"; } | |
Push avatars webapp-avatars | |
Push uploads webapp-uploads | |
Push0 /etc webserv1-etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment