#!/bin/tcsh -f #H# This script is designed to be used in a remote rsync situation where rsync was run with: #H# rsync --rsync-path="/path/to/rsync-if-mounted" #H# This will cause rsync to fail if the remote path is not a mounted filesystem. #H# Unlike other similar scripts this one works whether the remote is the source or target. #H# Currently relies on /proc/mounts. set NumParams=$# set MountPoint=$argv[$NumParams] set MountPoint=`echo $MountPoint | sed -e 's/\/$//'` grep " $MountPoint " /proc/mounts > /dev/null && set Mounted="Y" || set Mounted="N" if ("$Mounted" == "Y") then exec rsync $* else echo "$MountPoint is NOT mounted. Aborting." > /dev/stderr exit 1 endif