aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mirror
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mirror')
-rw-r--r--modules/mirror/templates/mirrordir8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/mirror/templates/mirrordir b/modules/mirror/templates/mirrordir
index 5d2ad401..53655aa0 100644
--- a/modules/mirror/templates/mirrordir
+++ b/modules/mirror/templates/mirrordir
@@ -5,8 +5,12 @@ localdir="<%= localdir %>"
rsync_options="<%= rsync_options %>"
lockfile="<%= lockfile %>"
-test -f "$lockfile" && echo "sync already in progress" && exit
-touch "$lockfile"
+if [ -f "$lockfile" ]; then
+ # show error message when run from command line
+ [ -t 1 ] && cat $lockfile
+ exit
+fi
+echo "sync in progress since $(date)" > "$lockfile"
/usr/bin/rsync $rsync_options "$remoteurl" "$localdir"
rm -f "$lockfile"