Table of Contents

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
/var/customers/webs/cw01/wiki/data/pages/filesystems/using_lsyncd_and_csync2.txt · Last modified: 2012/01/23 15:02 by wadmin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki