aboutsummaryrefslogtreecommitdiff
path: root/bin/sync
blob: c683608dbf50b96f768cfbe92b41bc4555306e3d (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 $DIRNAME
rsync -avz $ORIGIN/ data/

# Teardown
rm $LOCKFILE