File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/env bash
1
+ #! /bin/bash
2
2
3
+ OPTIONS=" -rtlHqv --delete-after --delay-updates --safe-links"
4
+ REPO=" rsync://mirrors.kernel.org/$1 "
5
+ DEST=" /media/mirror/$1 "
6
+ LCK_FLE=" /var/lock/mirror/$1 .lck"
7
+ LOG_FLE=" /var/log/mirror/$1 .log"
8
+
9
+ # Check for arguments
3
10
if [ -z $1 ]; then
4
11
echo " Usage: sync.sh [DISTRO]"
5
12
exit 1
6
13
fi
7
14
8
- OPTIONS=" -rtlHqv --delete-after --delay-updates --safe-links"
9
- REPO=" rsync://mirrors.kernel.org/$1 "
10
- DEST=" /media/mirror/$1 "
11
- LCK_FILE=" /tmp/rsync-mirror-$1 .lck"
12
- LOG_FILE=" /tmp/log-$1 .log"
13
-
14
15
# Make sure only 1 instance runs
15
- if [ -e " $LCK_FILE " ]; then
16
- OTHER_PID=` cat $LCK_FILE `
17
- echo " Another instance already running: $OTHER_PID "
16
+ if [ -e " $LCK_FLE " ]; then
17
+ OTHER_PID=` cat $LCK_FLE `
18
+ echo " Another instance already running: $OTHER_PID " > $LOG_FLE
18
19
exit 1
19
20
fi
20
- echo $$ > " $LCK_FILE "
21
+ echo $$ > " $LCK_FLE "
21
22
22
23
# Sync
23
- rsync $OPTIONS $REPO $DEST & > $LOG_FILE
24
+ rsync $OPTIONS $REPO $DEST & > $LOG_FLE
24
25
25
26
# Cleanup
26
27
rm -f " $LCK_FLE "
You can’t perform that action at this time.
0 commit comments