Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
b3b7e3b4
Commit
b3b7e3b4
authored
Apr 19, 2017
by
Igor Pecovnik
Browse files
Small RFC
parent
75c4a3eb
Changes
1
Show whitespace changes
Inline
Side-by-side
softy
View file @
b3b7e3b4
...
@@ -353,32 +353,33 @@ cat >> /etc/cron.daily/seed-armbian-torrent <<"EOF"
...
@@ -353,32 +353,33 @@ cat >> /etc/cron.daily/seed-armbian-torrent <<"EOF"
#
#
#
download
latest
torrent
pack
#
download
latest
torrent
pack
rm
-f
/
tmp
/
tmp.zip
;
wget
-qO-
-O
/
tmp
/
tmp.zip
https:
//
dl.armbian.com
/
torrent
/
all-torrents.zip
TEMP=
$(mktemp
-d
)
wget
-qO-
-O
$
TEMP
/
tmp.zip
https:
//
dl.armbian.com
/
torrent
/
all-torrents.zip
#
test
zip
for
corruption
#
test
zip
for
corruption
unzip
-t
/
tmp
/
tmp.zip
>
/dev/null 2>
&
1
unzip
-t
$
TEMP
/
tmp.zip
>
/dev/null 2>
&
1
[[ $? -ne 0 ]]
&&
echo "Error in zip"
&&
exit
[[ $? -ne 0 ]]
&&
echo "Error in zip"
&&
exit
# extract zip
# extract zip
unzip -o
/tmp
/tmp.zip -d
/tmp
/torrent-tmp >/dev/null 2>
&
1
unzip -o
$TEMP
/tmp.zip -d
$TEMP
/torrent-tmp >/dev/null 2>
&
1
# create list of current active torrents
# create list of current active torrents
transmission-remote -n 'transmission:transmission' -l | sed '1d; $d' >
/tmp
/torrent-tmp/active.torrents
transmission-remote -n 'transmission:transmission' -l | sed '1d; $d' >
$TEMP
/torrent-tmp/active.torrents
# loop and add/update torrent files
# loop and add/update torrent files
for f in
/tmp
/torrent-tmp/*.torrent; do
for f in
$TEMP
/torrent-tmp/*.torrent; do
transmission-remote -n 'transmission:transmission' -a $f > /dev/null 2>
&
1
transmission-remote -n 'transmission:transmission' -a $f > /dev/null 2>
&
1
# remove added from the list
# remove added from the list
pattern="${f//.torrent}"; pattern="${pattern
//\/tmp\/torrent-tmp\
/}";
pattern="${f//.torrent}"; pattern="${pattern
##*
/}";
sed -i "/$pattern/d"
/tmp
/torrent-tmp/active.torrents
sed -i "/$pattern/d"
$TEMP
/torrent-tmp/active.torrents
done
done
# remove old armbian torrents
# remove old armbian torrents
while read i; do
while read i; do
[[ $i == *Armbian_* ]]
&&
transmission-remote -n 'transmission:transmission' -t $(echo "$i" | awk '{print $1}';) --remove-and-delete
[[ $i == *Armbian_* ]]
&&
transmission-remote -n 'transmission:transmission' -t $(echo "$i" | awk '{print $1}';) --remove-and-delete
done
<
/
tmp
/
torrent-tmp
/
active.torrents
done
<
$
TEMP
/
torrent-tmp
/
active.torrents
#
remove
temporally
files
and
direcotories
#
remove
temporally
files
and
direcotories
rm
-rf
/
tmp
/
torrent-tmp
rm
-rf
$
TEMP
EOF
EOF
chmod
+
x
/
etc
/
cron.daily
/
seed-armbian-torrent
chmod
+
x
/
etc
/
cron.daily
/
seed-armbian-torrent
/
etc
/
cron.daily
/
seed-armbian-torrent
/
etc
/
cron.daily
/
seed-armbian-torrent
...
...
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