Mailing List CGatePro@mail.stalker.com Message #101356
From: Nicolas Hatier <nicolas.hatier@niversoft.com>
Subject: Re: Perl scripting for PIPE
Date: Tue, 11 Jan 2011 11:25:11 -0500
To: CommuniGate Pro Discussions <CGatePro@mail.stalker.com>
Glad it worked.

If ever you implement something else submitting mail via PIPE, especially if it can submit several messages in a short time, make sure to use a unique filename so you don't overwrite a previously submitted one. CGP may take several seconds to process them and overwriting means mail loss. You can use a timestamp and a random value or unique counter in your filename, for instance.

In would also be better to use mv instead of cp on notify.tmp -> notify.sub.
From the documentation: "Because of the way the PIPE module processes the Submitted folder, it is recommended to compose messages in a different file directory and then move the composed .sub files to the Submitted folder, or to compose messages in the Submitted folder, in files with the .tmp file name extension, and then change the file name extension to .sub."

Making a copy "takes time", and there is a risk CGP will process the mail before the copy is complete, leading to an incomplete message.

Nicolas


On 2011-01-11 09:54, Dan Pratt wrote:
Works after removing the router entry! I created that after trying to follow the documentation under "Delivering to External Applications". Thank you! 

I manually created the file notify.tmp in /var/CommuniGate/Submitted. Then did a cp notify.tmp notify.sub.

Now I just have to get my original backup shell script to add the file to the Submitted directory and I'm good to go.

- Dan


*************


From:	Nicolas Hatier <nicolas.hatier@niversoft.com>
Subject:	Re: Perl scripting for PIPE
Date:	Mon, 10 Jan 2011 23:15:45 -0500
To:	CommuniGate Pro Discussions <CGatePro@mail.stalker.com>

myusername@pipe ? Where does that come from? To you have special router instructions related to PIPE? Note that you don't need any specific router entry for my example to work. If you tried to configure some PIPE-specific router entries to make that work, remove or disable them.

Nicolas



*************


On 2011-01-10 23:00, Dan Pratt wrote:
No luck. Below is what I get in the logs. 

BTW, I had a router entry of: 

<myusername@gmail.com>
 = execmyusername@pipe


21:45:45.001 4 ROUTER Input(Mail): 
<myusername@gmail.com>

21:45:45.001 5 ROUTER PARSER: '
<myusername@gmail.com>
' -> 'myusername' at 'gmail.com'
21:45:45.001 4 ROUTER Alias: -> 'myusername@pipe'
21:45:45.001 5 ROUTER SYSTEM: -> 'myusername@pipe'
21:45:45.001 5 ROUTER PARSER: 'myusername@pipe' -> 'execmyusername' at 'pipe'
21:45:45.001 1 ROUTER PIPE: '
<myusername@gmail.com>
' rejected. Error Code=External Applications Directory is not specified
21:45:45.001 1 DEQUEUER [9064558] SYSTEM()
<myusername@gmail.com>
 failed: External Applications Directory is not specified


*************


From:	Nicolas Hatier 
<nicolas.hatier@niversoft.com>

Subject:	Re: Perl scripting for PIPE
Date:	Mon, 10 Jan 2011 21:53:15 -0500
To:	CommuniGate Pro Discussions 
<CGatePro@mail.stalker.com>


You don't absolutely need a Perl script.

All you have to do is put a message in the PIPE directory - usually /var/Communigate/Submitted
In the file, you can put a normal email message with headers, such as
To: 
myusername@gmail.com

From: Root
Subject: Nightly backup 

Nightly backup $NOWDATE completed

CGP will process it and send it to the To address. You can include an Envelope-To: header if you want the recipient to be something else than the To: header.

Name your file something.tmp while you're writing it, then rename it something.sub. CGP processes *.sub every 15 seconds by default. 

Nicolas


On 2011-01-10 18:16, Daniel Pratt wrote:

I have a shell script that runs every morning at 3am backing up the /var/CommuniGate directory to a second volume. Works great. New file every night date stamped correctly. At the end of the script I want it to send me an email notification to my gmail account.

So I did:

    echo "Nightly backup $NOWDATE completed" | mail -s "Nightly Backup" 

myusername@gmail.com



However, that won't work as the installer renames the /usr/bin/mail program to /usr/bin/LegacyMail.

So now my messages end up in the Submitted folder as .sub files. Researching this I need to get a Perl script for the PIPE Application Directory setting to trigger to get my simple email notification to go out.

I'm not up on Perl scripting (obviously should be). Has someone already created a script to do this?

Should I approach this differently?

Thanks.



- Dan Pratt
v5.3.10
Mac OS X (10.6.4) / MacMini SnowLeopard Server
/var/Communigate directory on Promise SmartStor DS4600 RAID Tower
#############################################################
This message is sent to you because you are subscribed to
  the mailing list 

<CGatePro@mail.stalker.com>

.
To unsubscribe, E-mail to: 

<CGatePro-off@mail.stalker.com>


To switch to the DIGEST mode, E-mail to 

<CGatePro-digest@mail.stalker.com>


To switch to the INDEX mode, E-mail to 

<CGatePro-index@mail.stalker.com>


Send administrative queries to  

<CGatePro-request@mail.stalker.com>

    

--

Nicolas Hatier, ing. <nicolas.hatier@niversoft.com>
Niversoft idées logicielles - http://www.niversoft.com

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster