WolfPack/offload-wolfpack

32 lines
1.2 KiB
Plaintext
Raw Normal View History

Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
#!/bin/bash
2020-11-09 04:57:56 -06:00
set -x
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
target="$1"
2020-11-09 04:57:56 -06:00
dir=`sudo -u deluge deluge-console config download_location 2>/dev/null | head -n 1 | sed 's/download_location: //'`
2020-11-09 04:57:56 -06:00
if [ -z "$target" ]; then # || [ "$(ping -c 2 "$target" &>/dev/null; echo $?)" -ne 0 ]; then
echo Usage: $0 '[target]';
2017-02-13 20:33:58 -06:00
exit 1
fi
2018-02-04 02:37:50 -06:00
ssh $target mkdir -p /srv/yggdrasil/new_acquisition
timeout 60 sudo -u deluge /bin/bash -l -c 'deluge-console info' 2>/dev/null | egrep '^\[S\]' | (
2020-11-09 04:57:56 -06:00
while read line; do
id="$(echo "$line" | awk '{ print $4; }')"
name="$(echo "$line" | awk '{ print $3 }')"
# Clean up downloads before sending.
rm -Rf "$dir"/"$name"/*.nfo "$dir"/"$name"/*.txt "$dir"/"$name"/*.png "$dir"/"$name"/*.jpg
rsync -avzz "$dir"'/'"$name" $target:/srv/yggdrasil/new_acquisition
ret="$?"
if [ "$ret" -eq 0 ]; then
# Hack because `deluged rm -c $id` isn't working
sudo systemctl stop deluged
sudo rm -Rf /srv/deluge/.config/deluge/state"$id";
sudo systemctl start deluged
2020-11-09 04:57:56 -06:00
rm -Rf "$dir"'/'"$name"
else
echo "ERROR: Return was $ret" >> "$dir"/"$name"/error.log
fi
unset name; unset id;
done
) | systemd-cat -t "offload-wolfpack"