#!/bin/bash lockfile=lock : >> ${lockfile} exec 9>${lockfile} if ! flock -n 9 ; then #Another instance is running exit 1 fi #TODO: rsync : > ${lockfile}