From a4cc319ca0a64b1b20bb0eac450e4421aff0624b Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 20 Jan 2012 23:05:57 +0000 Subject: better error message when a sync is running, but only show when run from command line --- modules/mirror/templates/mirrordir | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/mirror/templates') 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" -- cgit v1.2.1