LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-01-2003, 08:28 PM   #1
tubedogg
LQ Newbie
 
Registered: Oct 2003
Posts: 1

Rep: Reputation: 0
Piping email to two destinations?


This is probably a really stupid question, but how do you pipe an email to two or more destinations?

I'm using
|/home/mysite/myprocessfile.php
Is there any way I can change that so the email will be passed to two different files?

Thanks!
 
Old 10-05-2003, 02:09 AM   #2
clacour
Member
 
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98

Rep: Reputation: 16
I'm still trying to find a _good_ way, but this should at least work:

If you really want it to go to two files (real files), it's easy:

| tee file1 > file2

"tee" writes one copy to the filename you give it, and the other to stdout. Redirect stdout to file2, and you're in good shape.

If you want to do what it looks like you want from what you wrote, which is to pipe it to two different programs, it's not as easy. You can still make it work with tee, but it's a kludge:

Make a named pipe. In this example, I'll call it "pipe2two".

Set up your email pipe:

| tee pipe2two | script1.php

The very first thing in script1.php should be:

cat pipe2two | script2.php &

(That "&" on the end is important, it makes it run in the background and lets the rest of script2 run.)

I don't know php. If it won't let you kick off a command like that cat, you might have to do it with a bash script. The same basic idea applies: use a named pipe (or two, or three) to fool tee into thinking it's writing to a file, then do a "cat" fromt the named pipe to the program that needs the data.

Hope this helps,

CHL
 
Old 12-04-2003, 08:21 PM   #3
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
using the "<" operator might work for you:

mail name@host < filename

can you have more than one recipient as arguments to the mail command? if so, that may do it.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulties installing new urpmi destinations iqbala Mandriva 1 10-23-2005 04:36 PM
Help with piping mijohnst Linux - General 7 10-21-2005 04:14 PM
using dd comand to write to multiple destinations dln2k5 Linux - Newbie 1 10-28-2004 05:17 PM
Piping video out to the TV only. dredgemortle Mandriva 3 07-05-2004 12:48 AM
Need Qmail expert for email piping problem DaveNET Linux - Software 0 01-09-2003 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration