Posts Tagged ‘Linux’

Merging multiple tiff files into one

Tuesday, February 28th, 2012


The following concatenates two files and writes the result using LZW encoding:

tiffcp -c lzw a.tif b.tif result.tif

source :

Got spare pcs or linux boxes ? build your own supercomputer

Wednesday, September 21st, 2011

Fax to Email to folder in Linux

Wednesday, November 18th, 2009

Needed to move away from the single fax machine and find a better solution for receiving and processing faxes. Decided to move over to fax to email service and automating the extraction of fax images from the emails.
Tested on Centos, but should work on any Linux distro with a little tweaking.
You must have fetchmail and uudeview installed. use yum to install these.
*Recent updates of Centos warn you not to run fetchmail as root. You could either ignore this or run fetchmail as a non root user.

1. Signup for a faxtoemail service i.e and set the faxes to be forwarded to an email address eg as tif attachment.
Create a local user on Centos to retrieve the emails. lets suppose the user created is ‘fax’
Configure fetchmail to retrieve emails for this user
create file /root/.fetchmailrc with the following content
poll protocol POP3 user fax password yourpassword is fax

Change permission for the created file
chmod 0710 /root/.fetchmailrc
create a script to fetch the emails and extract the attachment. create file /home/fax/ with following content

#pop the mails from faxuser account frm mailserver
/usr/bin/fetchmail -a -v >> /var/log/fetchmail 2>&1
#run uudeview to strip attachment

/usr/bin/uudeview -i +a +o -q -p $TOSPLITFOLDER   $FAXUSERFILE
#clear the mailfile
cp /dev/null $FAXUSERFILE

Save the file and make it executable
chmod ugo+x /home/fax/
try sending a fax to your efax number and then run the script after a few minutes
sh /home/fax/

you can automate the execution by adding it as a cron job.

explanation of commands
in uudeview
-i suppresses interactivity
+a makes it append _1 instead of overwriting already existing file
+o stops overwriting
-q suppresses output messages ( so that cron does not send u mails)
-p to specify path where the decoded attachments should be sent