Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
6d44bac2
Commit
6d44bac2
authored
Nov 24, 2019
by
Downloader
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsync_all.sh: sync base and delete old files only after success
parent
bc41d41b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
rsync_all.sh
etersoft-cron/rsync_all.sh
+29
-18
No files found.
etersoft-cron/rsync_all.sh
View file @
6d44bac2
#!/bin/bash
#!/bin/bash
# Written by Lav (c) 2001, 2002, 2003, 2004, 2008, 2016
# Written by Lav (c) 2001, 2002, 2003, 2004, 2008, 2016
, 2019
# Vitaly Lipatov <lav@etersoft.ru>
# Vitaly Lipatov <lav@etersoft.ru>
# 24.12.01, 16.11.03, 30.12.03, 17.12.04
# 24.12.01, 16.11.03, 30.12.03, 17.12.04
# Обновление Сизифа
# Обновление Сизифа
...
@@ -52,7 +52,7 @@ fi
...
@@ -52,7 +52,7 @@ fi
RPMS
=
/var/ftp/pub/ALTLinux
RPMS
=
/var/ftp/pub/ALTLinux
TIMEOUT
=
5000
TIMEOUT
=
5000
LISTARCH
=
"
i586 x86_64 x86_64-i586 noarch
"
LISTARCH
=
"
x86_64 noarch i586 x86_64-i586
"
DELETE
=
"--delete-after --delete-excluded --max-delete=1000"
DELETE
=
"--delete-after --delete-excluded --max-delete=1000"
...
@@ -65,7 +65,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
...
@@ -65,7 +65,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
# sync only if main dir is exist
# sync only if main dir is exist
test
-d
"
$RPMS
/
${
1
/\/*/
}
"
||
return
0
test
-d
"
$RPMS
/
${
1
/\/*/
}
"
||
return
0
mkdir
-p
$RPMS
/
$1
/
mkdir
-p
$RPMS
/
$1
/
rsync
$DELETE
--fuzzy
--partial
--
inplace
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
$2
\
rsync
$DELETE
--fuzzy
--partial
--
timeout
=
$TIMEOUT
--progress
$CHECKSUM
--stats
-vrlt
--copy-links
$2
\
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
RES
=
$?
RES
=
$?
echo
"rsync exit:
$RES
"
echo
"rsync exit:
$RES
"
...
@@ -81,24 +81,38 @@ sync_file()
...
@@ -81,24 +81,38 @@ sync_file()
RSYNCPATH
=
$(
get_rsync_path
$1
)
RSYNCPATH
=
$(
get_rsync_path
$1
)
echo
echo
echo
"Start sync from
$RSYNCPATH
/
$1
to
$RPMS
/
$1
"
echo
"Start sync from
$RSYNCPATH
/
$1
to
$RPMS
/
$1
"
rsync
$DELETE
--fuzzy
--partial
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
\
rsync
$DELETE
--fuzzy
--partial
--timeout
=
$TIMEOUT
--progress
$CHECKSUM
--stats
-vrlt
--copy-links
\
--exclude
"*SRPMS*"
\
--exclude
"*SRPMS*"
--exclude
"*RPMS.debuginfo*"
\
$RSYNCPATH
/
$1
$RPMS
/
$1
$RSYNCPATH
/
$1
$RPMS
/
$1
}
}
sync_branch
()
{
local
BRANCH
=
"
$1
"
local
ARCH
=
"
$2
"
RSYNCPATH
=
$(
get_rsync_path
$BRANCH
)
# 1. sync files, without delete
(
DELETE
=
''
func
$BRANCH
/
$ARCH
'--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude */base/*'
)
||
return
# 2. sync base
func
$BRANCH
/
$ARCH
/base
||
return
# 3. if all is ok, remove old files
func
$BRANCH
/
$ARCH
'--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude */base/*'
||
return
}
sync_branches
()
sync_branches
()
{
{
RSYNCPATH
=
$(
get_rsync_path
$1
)
RSYNCPATH
=
$(
get_rsync_path
$1
)
local
i
local
i
if
[
-n
"
$BASEONLY
"
]
;
then
if
[
-n
"
$BASEONLY
"
]
;
then
for
i
in
$LISTARCH
;
do
for
i
in
$LISTARCH
;
do
func
$1
/
$i
/base
--checksum
func
$1
/
$i
/base
done
done
return
return
fi
fi
for
i
in
$LISTARCH
;
do
for
i
in
$LISTARCH
;
do
func
$1
/
$i
'--exclude *SRPMS*'
sync_branch
"
$1
"
"
$i
"
done
done
}
}
...
@@ -126,6 +140,12 @@ if [ "$1" = "base" ] ; then
...
@@ -126,6 +140,12 @@ if [ "$1" = "base" ] ; then
shift
shift
fi
fi
CHECKSUM
=
''
if
[
"
$1
"
=
"--checksum"
]
;
then
CHECKSUM
=
"--checksum"
shift
fi
if
[
"
$1
"
=
"Sisyphus"
]
;
then
if
[
"
$1
"
=
"Sisyphus"
]
;
then
sync_branches
$1
sync_branches
$1
exit
exit
...
@@ -147,22 +167,13 @@ elif [ -n "$1" ] ; then
...
@@ -147,22 +167,13 @@ elif [ -n "$1" ] ; then
exit
exit
fi
fi
# we do not update 5.0
for
i
in
c7 c8 p8 p9
;
do
#for i in 4.0 4.1 p5 p6 c6 t6 p7 t7; do
for
i
in
p6 p7 p8
;
do
# move branches
#mkdir $i/branch/ || continue
#for a in i586 x86_64 x86_32 noarch ; do
# mv $i/$a $i/branch/ || exit
# ln -s branch/$a $i/$a || exit
#done
sync_branches
$i
/branch
sync_branches
$i
/branch
done
done
sync_other p8/images
#
sync_other p8/images
for
i
in
Sisyphus
;
do
for
i
in
Sisyphus
;
do
# FIXME: cert6/x86_32?
sync_branches
$i
sync_branches
$i
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment