aboutsummaryrefslogtreecommitdiff
path: root/bin/sync
blob: 93c9eaaeb1935356bc964e6180d19c5b7373f3e2 (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.fluxo.info/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