Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 29th December 2009, 21:11
sjau sjau is online now
Local Meanie
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts
Default Convert scan-2-ftp into scan-2-email

Hi there

In my place I setup today a network printer in such a way, that I can scan-to-email while the printer itself supports only scan-2-ftp.

The printer itself provides a custom of scan profile that can easily customized. In that way I could setup for everyone an own profile and hence custom login data to the ftp server.

The ftp server itself is a small "home-made" business server. It serves the webpage and acts as email server. So on that server I setup proftpd with virtual users on mysql according to the howtos in here.

With that combination I was able to provide for each scan-to-ftp profile on the printer a custom ftp mail account with a custom dir.

What I needed then was a script that regurarly checks the ftp folders and sends an email if a new file is there.

I used this script here that i wrote:




for I in ${!user_arr[*]}
        cd $basefolder/$user
        for F in `ls`
                VAL=`lsof $basefolder/$user/$F`
                if [ -z $VAL ]
                        echo $F
                        echo $email
                        mutt -s "Scanner - Dokumente" -a $F $email < $emailtext
                        rm $F

rm $basefolder/sent
And then I run that every minute by cron.

I have tested this a little today and it works quite well. However I'm not sure if that script above is good. The only way I could think of to check if a new document has been finished transferring from the printer to the server is by the use of the lsof command.

If you have better suggestions I'd be glad to hear that.
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
Sponsored Links


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting FTP bswinnerton Installation/Configuration 4 10th October 2008 20:34
ftp is very slow and asks for user/passwd continuously chico58 Installation/Configuration 7 8th October 2008 13:43
proFTPd passive mode problems bisbell Server Operation 8 6th August 2008 22:12
Question about Virtual Hosting With Proftpd And MySQL (Incl. Quota) On Debian Etch ikkem HOWTO-Related Questions 30 26th February 2008 20:38
Website users? ctroyp General 25 6th January 2006 19:02

All times are GMT +2. The time now is 09:04.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.