2006-06-10 20:48:06 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# MPlayer mirroring script
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
PATH=<set_path_if_necessary>
|
|
|
|
LOCK=<path_to_lockfile>
|
|
|
|
MIRROR_ROOT=<path_to_mirror_root>
|
|
|
|
MAILADR=<report_mail_to_adr>
|
|
|
|
|
2006-06-14 10:22:32 +00:00
|
|
|
#TMPDIR = /tmp
|
2006-06-10 20:48:06 +00:00
|
|
|
#export TMPDIR
|
|
|
|
|
|
|
|
TMPFILE=`mktemp -t mplayer.XXXXXXXXXXX`
|
|
|
|
|
|
|
|
# Check to see if another sync is in progress
|
|
|
|
if lockfile -! -l 43200 -r 0 "$LOCK"; then
|
|
|
|
echo Unable to start mirroring MPlayer, lock file exists.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
trap "rm -f $LOCK > /dev/null 2>&1" exit
|
|
|
|
|
|
|
|
cd $MIRROR_ROOT
|
|
|
|
|
2006-06-14 10:22:32 +00:00
|
|
|
echo "************ rsyncing homepage ************" >> $TMPFILE
|
2006-06-24 21:51:51 +00:00
|
|
|
rsync -pxlrHtWv --delete --delete-after rsync.mplayerhq.hu::homepage/ \
|
2006-06-14 10:22:32 +00:00
|
|
|
homepage >> $TMPFILE 2>&1
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-14 10:22:32 +00:00
|
|
|
echo "************ rsyncing MPlayer ************" >> $TMPFILE
|
2006-06-10 20:48:06 +00:00
|
|
|
rsync -pxlrHtWv --delete --delete-after --exclude '/benchmark' \
|
2006-06-24 21:51:51 +00:00
|
|
|
--exclude '/old_stuff' --exclude '/tests' rsync.mplayerhq.hu::ftp/ \
|
2006-06-14 10:22:32 +00:00
|
|
|
MPlayer >> $TMPFILE 2>&1
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-14 10:22:32 +00:00
|
|
|
x=`wc -l $TMPFILE | awk '{print $1}'`
|
2006-06-10 20:48:06 +00:00
|
|
|
if [ "$x" -ne "10" ]
|
|
|
|
then
|
2006-06-14 10:22:32 +00:00
|
|
|
mailx -s "MPlayer mirror" $MAILADR < $TMPFILE
|
2006-06-10 20:48:06 +00:00
|
|
|
fi
|
|
|
|
rm -f $TMPFILE
|
|
|
|
|