Bläddra i källkod

Started the "plunder" script.

master
treyzania 6 år sedan
förälder
incheckning
653e99f202
4 ändrade filer med 47 tillägg och 2 borttagningar
  1. 2
    2
      booty.sh
  2. 0
    0
      localconfig-booty
  3. 5
    0
      localconfig-plunder
  4. 40
    0
      plunder.sh

+ 2
- 2
booty.sh Visa fil

@@ -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 Visa fil


+ 5
- 0
localconfig-plunder Visa fil

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


+ 40
- 0
plunder.sh Visa fil

@@ -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?


Laddar…
Avbryt
Spara