View Single Post
  #4  
Old 23rd November 2009, 07:19
almeister9 almeister9 is offline
Member
 
Join Date: Sep 2008
Posts: 36
Thanks: 6
Thanked 3 Times in 3 Posts
Default The Ultra Elusive pure-uploadscript(8)

I have now started again from scratch.
I have an Ubuntu 9.04 32-bit server as Falko's:
http://www.howtoforge.com/perfect-se...ispconfig-2-p4
up to stage 10.
with a working Pure-ftpd server as per Falkos:
http://www.howtoforge.com/virtual-ho...ubuntu-9.04-p2

I then installed ssmtp:
sudo apt-get install ssmtp

and configured:
sudo vi /etc/ssmtp/ssmtp.conf

Code:
root=myemailaddress@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=mygmailusername
AuthPass=mypassword
UseSTARTTLS=YES
Then by typing into terminal:
ssmtp recipient_email@example.com and hitting enter, then
To: recipient_email@example.com
From: myemailaddress@gmail.com
Subject: test email

hello world!

and then crtl+D it successfully sends a mail via my gmail account.

Code:
I edit Pure-ftp conf file:
vi /etc/default/pure-ftpd-common

and make sure option "STANDALONE_OR_INETD" is "STANDALONE"
set
UPLOADUID=0 
UPLOADGID=0
(because it said to on the man page)
and:
UPLOADSCRIPT=/usr/local/sbin/uploadscript.sh
All that above I got from one of the very few sources I could find on the internet and it basically said "then create a script that does something useful and you are done.
This did not eaxctly help me.
I persisted:
vi /usr/local/sbin/uploadscript.sh
Code:
#! /bin/sh
echo "$1 uploaded" | ssmtp al@dvdindustry.com.au
To:al@dvdindustry.com.au
From: almeister9g@gmail.com
Subject: New File Uploaded

"$1 uploaded"
No Dice
I found another source that gave a small amount of help:http://blog.derjohn.de/space/start/2006-11-14/1
which said:
Step 6: Check if the daemon really run with the new options. (Doesn't say how)
Code:
root 18623 0.0 0.0 12120 868 ? Ss 19:39 0:00 pure-ftpd (SERVER) www-data 18671 0.0 0.0 11912 672 ? Ss 19:40 0:00 /usr/sbin/pure-uploadscript -r /usr/local/sbin/uploadhandler.pl -B -u 33 -g 33
Don't know what that means
Step 7: Create a test script. E.g. this one will write the filename to a file called /tmp/pure-was-here<datestamp>.
Code:
#!/bin/sh echo "$1" > /tmp/pure-was-here$(date +%Y%m%d%H%M%S)
Step 8: Test the script, log in via ftp and upload a file:
I tried that and uploaded a file but the file in /TEMP/ doesn't get created.


I have read the man page for pure-uploadscript over and over but it doesn't seem to tell me how to do anything, just what it can do.

I assume that what I need to do now is:
1). Learn how to create a shell script and then place it somewhere and tell the conf page where it is (UPLOADSCRIPT=)
2). Learn how to get said shell script to use ssmtp to send an email using the available things passed from uploadscript ($1 and others ???)
3). Prey that it works because if it doesn't I have no where to turn.

I feel I am so close now,

Any help that any kind soul could lend me would be greatly appreciated.

Cheers Al.
Reply With Quote