User Tools

Site Tools


Sidebar

js#vista.png msort nsort

filesystems:using_lsyncd_and_csync2

Lsyncd wrapper

usage: lsyncdwrap </path/to/status/file> <command> <command_options>

#!/bin/sh

STATFILE=$1
shift
CMDLINE=$@

if [ -s $STATFILE ]; then
	exit 0
fi

START=`date +%s`
$CMDLINE >> $STATFILE 2>&1
ERR=$?
END=`date +%s`
DIFF=$(($END - $START))

# append to STATFILE
if [ $ERR -ne 0 ]; then
        echo "### ERROR: `date` ### TIME [$DIFF] - ARGS: $@" >> $STATFILE
else
	echo -n "" > $STATFILE
fi

exit 0
filesystems/using_lsyncd_and_csync2.txt · Last modified: 2020/02/24 11:16 (external edit)