aboutsummaryrefslogtreecommitdiff
path: root/bin/sync
blob: ffee35832cedef7683b4332a509ba2c497c5445b (plain)
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
#!/bin/bash
#
# Simple sync script.
#

# Parameters
DIRNAME="`dirname $0`"
WORK="$DIRNAME/.."
CWD="`pwd`"
LOCKFILE="$WORK/.sync-lockfile"
ORIGIN="rsync://cache.sarava.org/cache/data"

# Set lockfile
if [ -e "$LOCKFILE" ]; then
  echo "Locked!"
  exit 1
else
  touch $LOCKFILE || exit 1
fi

# Sync
cd $WORK
rsync -avz $ORIGIN/ data/

# Teardown
rm $LOCKFILE