WolfPack/offload-wolfpack

43 lines
1.5 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
logfile=/var/log/wolfpack.log
target="$1"
dir=`sudo -u deluge deluge-console config download_location 2>/dev/null | head -n 1 | sed 's/ download_location: //'`
2018-02-04 02:37:50 -06:00
if [ -z "$target" ] || [ "$(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
sudo -u deluge deluge-console info 2>/dev/null | (
unset name;
unset id;
unset state;
while read line; do
case "$line" in
"Name:"*) name="$(echo $line | sed 's/Name: //')"; ;;
"State:"*) state="$(echo $line | cut -f 2 -d ' ')"; ;;
"ID:"*) id="$(echo $line | sed 's/ID: //')"; ;;
*)
if [ ! -z "$name" ] && [ ! -z "$id" ] && [ ! -z "$state" ]; then
echo Found "$name" "($id)" with state "$state"
if [ -e "$dir"'/'"$name" ]; then
echo "$name" exists on disk.
fi
if [ "$state" == "Seeding" ]; then
sudo -u deluge deluge-console 2>/dev/null rm "$id";
rsync -avz "$dir"'/'"$name" $target:/srv/yggdrasil/new_acquisition
ret="$?"
if [ "$ret" -eq 0 ]; then
rm -Rf "$dir"'/'"$name"
else
echo "ERROR: Return was $ret" >> "$dir"/"$name"/error.log
fi
fi;
unset name; unset id; unset state;
fi ;;
esac
done)
cat /var/log/wolfpack.log | ssh $target /bin/bash -c 'cat >> /var/log/wolfpack.log'
cat /dev/null > /var/log/wolfpack.log