Explorar el Código

Started the "plunder" script.

master
treyzania hace 6 años
padre
commit
653e99f202
Se han modificado 4 ficheros con 47 adiciones y 2 borrados
  1. 2
    2
      booty.sh
  2. 0
    0
      localconfig-booty
  3. 5
    0
      localconfig-plunder
  4. 40
    0
      plunder.sh

+ 2
- 2
booty.sh Ver fichero

@@ -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 Ver fichero


+ 5
- 0
localconfig-plunder Ver fichero

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


+ 40
- 0
plunder.sh Ver fichero

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


Cargando…
Cancelar
Guardar