You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 5 години
12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. MAIN_CONFIG="~/.config/bootybot/plunder.conf"
  3. if [ -f localconfig ]; then
  4. source localconfig-plunder
  5. elif [ -f "$MAIN_CONFIG" ]; then
  6. source $MAIN_CONFIG
  7. else
  8. echo 'error: no valid config found'
  9. exit 1
  10. fi
  11. # This is from the Deluge Execute plugin.
  12. tid=$1
  13. tname=$2
  14. tpath=$3
  15. ########
  16. troot="$tpath/$tid"
  17. rxpath="$remote_rx_dir/$tid"
  18. mvpath="$remote_mv_dir/$tid"
  19. function remote_exec () {
  20. ssh $ssh_opts $ssh_prop $@
  21. }
  22. # Setup.
  23. remote_exec mkdir -p $remote_rx_dir
  24. remote_exec mkdir -p $remote_mv_dir
  25. # Actual transfer.
  26. remote_exec mkdir "$txpath"
  27. scp -r $troot $ssh_prop:"$remote_rx_dir"
  28. # Cleanup. This should be very fast.
  29. remote_exec mv "$rxpath" "$mvpath"
  30. # TODO Automaticially invoke (& fork) the rename script?