Heading off to work, I'll check out the links there. Thanks!
Execute auto upload after complete
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
Depending on your python experience you might find using a bash script easier.
http://www.linuxconfig.org/example-of-s ... ipt-client
http://www.linuxconfig.org/example-of-s ... ipt-client
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
Bash I am more comfortable with. Thanks for both the links!
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
That bash script is exactly what I need.
My only question is if $1 will only upload the files/folders that just finished per the torrent or if it will dump everything in my "completed" dir?
My only question is if $1 will only upload the files/folders that just finished per the torrent or if it will dump everything in my "completed" dir?
Code: Select all
#!/bin/bash
ftp_site=myhostname
username=myusername
passwd=mypass
PS3='Select a destination directory: '
# bash select
select path in "." "public_html/" "public_html/myblog/" "backup/images/"
do
ftp -in <<EOF
open $ftp_site
user $username $passwd
cd ]$path
put $1
close
bye
EOF
echo $1 uploaded to $path !
# Break, otherwise endless loop
break
done
Re: Execute auto upload after complete
it will be on a per torrent basis but i think you need $2 to get the file name.
it would be easier for you to code if you use variables set to those args at the top of your script
it would be easier for you to code if you use variables set to those args at the top of your script
Code: Select all
torrentid=$1
torrentname=$2
torrentpath=$3
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
so something like this:
Code: Select all
#!/bin/bash
ftp_site=myhostname
username=myusername
passwd=mypass
torrentpath=$1
PS3='Select a destination directory: '
# bash select
select path in "." "public_html/" "public_html/myblog/" "backup/images/"
do
ftp -in <<EOF
open $ftp_site
user $username $passwd
cd $path
put $1
close
bye
EOF
echo $1 uploaded to $path !
# Break, otherwise endless loop
break
done
Re: Execute auto upload after complete
those 3 args $1, $2, $3 are fixed arguments passed to the script every time. you need to use $2 which is the torrent name not torrentid.
I have done a quick edit of the code but i have not tested it
I have done a quick edit of the code but i have not tested it
Code: Select all
#!/bin/bash
ftp_site=myhostname
username=myusername
passwd=mypass
torrentid=$1
torrentname=$2
torrentpath=$3
ftp -in <<EOF
open $ftp_site
user $username $passwd
cd $torrentpath
put $torrentname
close
bye
EOF
echo $torrentname uploaded to $path !
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
I'll give it a shot, thank you a ton for the help!
I've also been looking at other protocols to use. SCP seems to look pretty handy, but what syntax to use in order to get the right files is where I'm getting confused. Is this what I want to do in order to transfer the files/folders via SCP?
I've also been looking at other protocols to use. SCP seems to look pretty handy, but what syntax to use in order to get the right files is where I'm getting confused. Is this what I want to do in order to transfer the files/folders via SCP?
Code: Select all
scp -r $torrentid user:pass@mediabox.com ~/
Re: Execute auto upload after complete
ssh will not allow passwords from scripts, for obvious security reasons, so the only way is to create a ssh key and put it on the seed box and host an ssh daemon on your windows box with cygwin.
scp <source> <destination>
e.g.
scp $torrentname user@192.168.0.1:/home/user/destdir
($torrentid is not the filename)
scp <source> <destination>
e.g.
scp $torrentname user@192.168.0.1:/home/user/destdir
($torrentid is not the filename)
-
- Member
- Posts: 12
- Joined: Tue Oct 26, 2010 7:08 am
Re: Execute auto upload after complete
Awesome, this is all doable as well. Looks like I have some options to play with here. Now to just get off work and test everything out.Cas wrote:ssh will not allow passwords from scripts, for obvious security reasons, so the only way is to create a ssh key and put it on the seed box and host an ssh daemon on your windows box with cygwin.
scp <source> <destination>
e.g.
scp $torrentname user@192.168.0.1:/home/user/destdir
($torrentid is not the filename)