18674
|
1 #!/usr/bin/env bash
|
|
2 # MPlayer mirroring script
|
|
3 # $Id$
|
|
4
|
|
5 PATH=<set_path_if_necessary>
|
|
6 LOCK=<path_to_lockfile>
|
|
7 MIRROR_ROOT=<path_to_mirror_root>
|
|
8 MAILADR=<report_mail_to_adr>
|
|
9
|
18700
|
10 #TMPDIR = /tmp
|
18674
|
11 #export TMPDIR
|
|
12
|
|
13 TMPFILE=`mktemp -t mplayer.XXXXXXXXXXX`
|
|
14
|
|
15 # Check to see if another sync is in progress
|
|
16 if lockfile -! -l 43200 -r 0 "$LOCK"; then
|
|
17 echo Unable to start mirroring MPlayer, lock file exists.
|
|
18 exit 1
|
|
19 fi
|
|
20 trap "rm -f $LOCK > /dev/null 2>&1" exit
|
|
21
|
|
22 cd $MIRROR_ROOT
|
|
23
|
18700
|
24 echo "************ rsyncing homepage ************" >> $TMPFILE
|
18806
|
25 rsync -pxlrHtWv --delete --delete-after rsync.mplayerhq.hu::homepage/ \
|
18700
|
26 homepage >> $TMPFILE 2>&1
|
18674
|
27
|
18700
|
28 echo "************ rsyncing MPlayer ************" >> $TMPFILE
|
18674
|
29 rsync -pxlrHtWv --delete --delete-after --exclude '/benchmark' \
|
18806
|
30 --exclude '/old_stuff' --exclude '/tests' rsync.mplayerhq.hu::ftp/ \
|
18700
|
31 MPlayer >> $TMPFILE 2>&1
|
18674
|
32
|
18700
|
33 x=`wc -l $TMPFILE | awk '{print $1}'`
|
18674
|
34 if [ "$x" -ne "10" ]
|
|
35 then
|
18700
|
36 mailx -s "MPlayer mirror" $MAILADR < $TMPFILE
|
18674
|
37 fi
|
|
38 rm -f $TMPFILE
|
|
39
|