mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-05-29 14:30:50 +00:00
This commit is contained in:
parent
24dd888ba7
commit
602fff3817
|
@ -1,7 +1,7 @@
|
||||||
-----
|
-----
|
||||||
-- User configuration file for lsyncd.
|
-- User configuration file for lsyncd.
|
||||||
--
|
--
|
||||||
-- This example uses refers to a problem in unix.
|
-- This example refers to a common problem in unix.
|
||||||
--
|
--
|
||||||
-- You have a shared directory for a set of users and you want
|
-- You have a shared directory for a set of users and you want
|
||||||
-- to ensure all users have read and write permissions on all
|
-- to ensure all users have read and write permissions on all
|
||||||
|
|
62
l4-rsync-data.sh
Executable file
62
l4-rsync-data.sh
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
CON="\E[47;34m"
|
||||||
|
COFF="\033[0m"
|
||||||
|
|
||||||
|
echo -e "$CON***********************************************************$COFF"
|
||||||
|
echo -e "$CON* Testing layer 4 default rsync with simulated changes. *$COFF"
|
||||||
|
echo -e "$CON***********************************************************$COFF"
|
||||||
|
|
||||||
|
WORKSOURCE=$(mktemp -d)
|
||||||
|
WORKTARGET=$(mktemp -d)
|
||||||
|
PIDFILE=$(mktemp)
|
||||||
|
LOGFILE=$(mktemp)
|
||||||
|
|
||||||
|
echo -e "$CON* populating the filesystem$COFF"
|
||||||
|
mkdir -p "${WORKSOURCE}"/a/a
|
||||||
|
echo 'test' > "${WORKSOURCE}"/a/a/file
|
||||||
|
|
||||||
|
echo -e "$CON* starting lsyncd$COFF"
|
||||||
|
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" --verbose --no-daemon "${WORKSOURCE}" "${WORKTARGET}"&
|
||||||
|
|
||||||
|
echo -e "$CON* waiting for lsyncd to start$COFF"
|
||||||
|
sleep 4s
|
||||||
|
|
||||||
|
# cp -r the directory
|
||||||
|
echo -e "$CON* making a lot of data$COFF"
|
||||||
|
for A in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
cp -r "${WORKSOURCE}"/a "${WORKSOURCE}"/b${A}
|
||||||
|
echo 'test2' > "${WORKSOURCE}"/b${A}/a/another
|
||||||
|
done
|
||||||
|
mkdir -p "${WORKSOURCE}"/c/a
|
||||||
|
echo 'test3' > "${WORKSOURCE}"/c/a/file
|
||||||
|
for A in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
cp -r "${WORKSOURCE}"/c "${WORKSOURCE}"/d${A}
|
||||||
|
echo 'test2' > "${WORKSOURCE}"/d${A}/a/another
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "$CON* waiting for lsyncd to do the job.$COFF"
|
||||||
|
sleep 10s
|
||||||
|
|
||||||
|
echo -e "$CON* killing lsyncd$COFF"
|
||||||
|
LSYNCPID=$(cat "${PIDFILE}")
|
||||||
|
if ! kill "${LSYNCPID}"; then
|
||||||
|
cat "${LOGFILE}"
|
||||||
|
diff -urN "${WORKSOURCE}" "${WORKTARGET}" || true
|
||||||
|
echo "kill failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1s
|
||||||
|
|
||||||
|
#echo "log file contents"
|
||||||
|
#cat "${LOGFILE}"
|
||||||
|
##this should be grep.
|
||||||
|
|
||||||
|
echo -e "$CON* differences$COFF"
|
||||||
|
diff -urN "${WORKSOURCE}" "${WORKTARGET}"
|
||||||
|
|
||||||
|
rm "${PIDFILE}"
|
||||||
|
rm "${LOGFILE}"
|
||||||
|
rm -rf "${WORKTARGET}"
|
||||||
|
rm -rf "${WORKSOURCE}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user