Hello...
I've been browsing these forums for a long time now and usually have found what I needed but this time I am lost...
I am hoping to put together a post processing script that will automatically run the "site rescan" on the release after its completed assuming it has an sfv in the dir.
If I missed it in another thread I apologize, and if anyone can help me... Thank you!
glftpd - post processing "site rescan"
Re: glftpd - post processing "site rescan"
Just pseudo-code off the top of my head but:
#!/bin/bash
cd $1
for sfv in *.sfv; do
if [-f $sfv ]; then
/path/to/site/rescan/binary (whatever params it takes)
fi
done
--
Hopefully that helps -- I'm no bash guru. It will run twice if there are two sfvs though, so you probably want to incorporate something that'll make subdirs and move stuff accordingly. I use the lftp mirror functionality to just upload the files locally via FTP and let the zipscript do its thing. Much cleaner that way
.
#!/bin/bash
cd $1
for sfv in *.sfv; do
if [-f $sfv ]; then
/path/to/site/rescan/binary (whatever params it takes)
fi
done
--
Hopefully that helps -- I'm no bash guru. It will run twice if there are two sfvs though, so you probably want to incorporate something that'll make subdirs and move stuff accordingly. I use the lftp mirror functionality to just upload the files locally via FTP and let the zipscript do its thing. Much cleaner that way

Re: glftpd - post processing "site rescan"
Thanks for the reply Mills. I am getting it to work, just have a couple problems with the variables, but I'll figure it out.
Thanks again though.
How does the lftp work? Is there a post-processing script for it?
Thanks again though.
How does the lftp work? Is there a post-processing script for it?
Last edited by markiejw on March 11th, 2010, 3:12 pm, edited 1 time in total.
Re: glftpd - post processing "site rescan"
Okay so I was having problems so I broke it down...
When I run this, everything is good...
#!/bin/bash
cd /
./glftpd/bin/rescan --chroot=/glftpd --dir=/glftpd/site/XVID/The.Release.Dir/ --normal
That will work as the post-processing script, of course only for that release.
I've tried to bring in the variables but I just can't figure it out...
#!/bin/bash
./glftpd/bin/rescan --chroot=/glftpd --dir=\"$1\" --normal
I've tried $1, ($1), $3, ($3), \"$3\", and I can't get it to go.
I think a problem might be because of the chroot. When I pull the $1 I get, /glftpd/site/XVID/The.Release/, which isn't good because the chroot=/glftpd has to be included. The rescan will not execute without the chroot. so it ends up being, chroot=/glfptd dir=/glftpd/site...., but I need it to be chroot=/glftpd dir=/site/... but using the variable.
When I run this, everything is good...
#!/bin/bash
cd /
./glftpd/bin/rescan --chroot=/glftpd --dir=/glftpd/site/XVID/The.Release.Dir/ --normal
That will work as the post-processing script, of course only for that release.
I've tried to bring in the variables but I just can't figure it out...
#!/bin/bash
./glftpd/bin/rescan --chroot=/glftpd --dir=\"$1\" --normal
I've tried $1, ($1), $3, ($3), \"$3\", and I can't get it to go.
I think a problem might be because of the chroot. When I pull the $1 I get, /glftpd/site/XVID/The.Release/, which isn't good because the chroot=/glftpd has to be included. The rescan will not execute without the chroot. so it ends up being, chroot=/glfptd dir=/glftpd/site...., but I need it to be chroot=/glftpd dir=/site/... but using the variable.
Re: glftpd - post processing "site rescan"
you can cut characters off of the beginning or end with 'cut' -- $dir = `echo $1 | cut --characters 6` or something similar.
lftp will upload the directory as though a FTP user were doing so, thus bypassing the need to run rescan manually. Check the man page.
lftp will upload the directory as though a FTP user were doing so, thus bypassing the need to run rescan manually. Check the man page.
Re: glftpd - post processing "site rescan"
okay so I got everything working, except the variables...
and I tried this...
The $1 isn't working... so I'm not sure how I should put that in there... if I put the actual path it works perfect.
Code: Select all
#!/bin/bash
lftp -e "cd $1 ; site rescan --normal ; exit" -u user,pass localhost -p 21
Code: Select all
#!/bin/bash
cd $1
lftp -e "site rescan --normal ; exit" -u user,pass localhost -p 21
Last edited by markiejw on March 11th, 2010, 11:42 pm, edited 1 time in total.
Re: glftpd - post processing "site rescan"
Ah I wasn't even thinking of using it to execute the ftp command, I use mirror to connect and upload (from hdd to hdd). But your way should work. $1 will have the full file path, you need the ftp path which will be without /glftpd/site, so $dir = `echo $1 | cut --characters 13-` ? Something like that, no *nix system to test on at the moment.
Re: glftpd - post processing "site rescan"
hrmmm... Can't seem to get the cut to work. I found the man for it and it goes... cut -c1-c12, which would cut character 1 through 12. I think the quotes are messing something up...Mills wrote: Ah I wasn't even thinking of using it to execute the ftp command, I use mirror to connect and upload (from hdd to hdd). But your way should work. $1 will have the full file path, you need the ftp path which will be without /glftpd/site, so $dir = `echo $1 | cut --characters 13-` ? Something like that, no *nix system to test on at the moment.
I tried...
Code: Select all
#!/bin/bash
cd "$1" | cut -c1-12
lftp -e "site rescan --normal ; exit" -u user,pass localhost -p 21
Code: Select all
#!/bin/bash
lftp -e "cd '$1 | cut -c1-12 | site rescan --normal ; exit" -u user,pass localhost -p 21
Re: glftpd - post processing "site rescan"
Like I said, set a new variable first and use that: dir=`echo $1 | cut --characters 13-` then use $dir
Last edited by Mills on March 12th, 2010, 6:03 pm, edited 1 time in total.