mirror of
https://github.com/DictXiong/dxsync.git
synced 2024-11-24 14:01:30 +08:00
init; not very clean
This commit is contained in:
commit
0690b9552b
3
locked.sh
Executable file
3
locked.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
sed -i '4 s/$/?/' /mnt/mirrors/status/${1//\//\-}.log
|
3
postsync.sh
Executable file
3
postsync.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/zsh
|
||||||
|
|
||||||
|
echo -e "${1}\n$(du -h --max-depth=0 /mnt/mirrors/$1 | awk '{print $1}')\n$(date +'%Y-%m-%d %H:%M:%S')\n${2}" > /mnt/mirrors/status/${1//\//\-}.log
|
4
presync.sh
Executable file
4
presync.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
sed -i "4c syncing..." /mnt/mirrors/status/${1//\//\-}.log
|
||||||
|
sed -i "3c $(date +'%Y-%m-%d %H:%M:%S')" /mnt/mirrors/status/${1//\//\-}.log
|
15
sync.sh
Executable file
15
sync.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
for src in {CTAN,ubuntu,docker-ce/linux/ubuntu,ubuntu-releases}
|
||||||
|
do
|
||||||
|
if [ ! -f "/tmp/mirror-${src//\//\-}.lock" ];
|
||||||
|
then
|
||||||
|
touch /tmp/mirror-${src//\//\-}.lock
|
||||||
|
/home/root/programs/dxsync/presync.sh $src
|
||||||
|
rsync -4avzthP --stats --delete --bwlimit=6000 --log-file=/var/log/rsync-mirrors-${src//\//\-}.log rsync://mirrors4.tuna.tsinghua.edu.cn/$src /mnt/mirrors/$src
|
||||||
|
/home/root/programs/dxsync/postsync.sh ${src} $?
|
||||||
|
rm /tmp/mirror-${src//\//\-}.lock
|
||||||
|
else
|
||||||
|
/home/root/programs/dxsync/locked.sh $src
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user