Browse Source

Started the "plunder" script.

master
treyzania 4 years ago
parent
commit
653e99f202
4 changed files with 47 additions and 2 deletions
  1. 2
    2
      booty.sh
  2. 0
    0
      localconfig-booty
  3. 5
    0
      localconfig-plunder
  4. 40
    0
      plunder.sh

+ 2
- 2
booty.sh View File

@@ -1,8 +1,8 @@
#!/bin/bash

MAIN_CONFIG="/etc/bootybot.conf"
MAIN_CONFIG="~/.config/bootybot/booty.conf"
if [ -f localconfig ]; then
source localconfig
source localconfig-booty
elif [ -f "$MAIN_CONFIG" ]; then
source $MAIN_CONFIG
else

localconfig → localconfig-booty View File


+ 5
- 0
localconfig-plunder View File

@@ -0,0 +1,5 @@
ssh_opts=
ssh_prop=localhost
remote_rx_dir=rx
remote_mv_dir=rename


+ 40
- 0
plunder.sh View File

@@ -0,0 +1,40 @@
#!/bin/bash

MAIN_CONFIG="~/.config/bootybot/plunder.conf"
if [ -f localconfig ]; then
source localconfig-plunder
elif [ -f "$MAIN_CONFIG" ]; then
source $MAIN_CONFIG
else
echo 'error: no valid config found'
exit 1
fi

# This is from the Deluge Execute plugin.
tid=$1
tname=$2
tpath=$3

########

troot="$tpath/$tid"
rxpath="$remote_rx_dir/$tid"
mvpath="$remote_mv_dir/$tid"

function remote_exec () {
ssh $ssh_opts $ssh_prop $@
}

# Setup.
remote_exec mkdir -p $remote_rx_dir
remote_exec mkdir -p $remote_mv_dir

# Actual transfer.
remote_exec mkdir "$txpath"
scp -r $troot $ssh_prop:"$remote_rx_dir"

# Cleanup. This should be very fast.
remote_exec mv "$rxpath" "$mvpath"

# TODO Automaticially invoke (& fork) the rename script?


Loading…
Cancel
Save