Re: [Mimedefang] calling external shell script without waiting for its end

2017-01-02 Thread Marcus Schopen
Hi Dianne,

Thanks for your time.

Am Montag, den 02.01.2017, 15:45 -0500 schrieb Dianne Skoll:
> On Mon, 02 Jan 2017 19:26:44 +0100
> Marcus Schopen  wrote:
> 
> > When calling an external bash script in filter_end like
> 
> >   system("/usr/local/bin/skript.sh $QueueID > /dev/null &");
> 
> I hope you trust the contents of $QueueID implicitly...

I use the QuarantineSubdir value, not QueueID, sorry for confusion. I
played with both of them.

> The MIMEDefang working directory gets deleted when the filter finishes.
> You most likely also want to be a little more careful with the standard
> file descriptors, so:
> 
> system("cd / && /usr/local/bin/skript.sh $QueueID < /dev/null > /dev/null 
> 2>&1 &")

Ah, thanks!

> but more importantly... ask yourself what you need that for and whether it
> would be better to rewrite skript.sh in Perl and integrated it into
> your filter directly.

Okay, I understand. I found another way to trigger the external script
by iwatch just touch'ing a file from within mimedefang to a directory
which is watched by iwatch. This is quite fast and keeps the script
separate from mimedefang.

Ciao!
Marcus


___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] calling external shell script without waiting for its end

2017-01-02 Thread Dianne Skoll
On Mon, 02 Jan 2017 19:26:44 +0100
Marcus Schopen  wrote:

> When calling an external bash script in filter_end like

>   system("/usr/local/bin/skript.sh $QueueID > /dev/null &");

I hope you trust the contents of $QueueID implicitly...

The MIMEDefang working directory gets deleted when the filter finishes.
You most likely also want to be a little more careful with the standard
file descriptors, so:

system("cd / && /usr/local/bin/skript.sh $QueueID < /dev/null > /dev/null 2>&1 
&")

but more importantly... ask yourself what you need that for and whether it
would be better to rewrite skript.sh in Perl and integrated it into
your filter directly.

Regards,

Dianne.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


[Mimedefang] calling external shell script without waiting for its end

2017-01-02 Thread Marcus Schopen
Hi,

happy new year to all! :)

When calling an external bash script in filter_end like

  system("/usr/local/bin/skript.sh $QueueID > /dev/null &");

I get the following error from time to time (mostly on receiving many
simultaneously mails):

Jan  2 18:38:13 serv mimedefang-multiplexor[7447]: v02HcBAF023342: Slave
1 stderr: shell-init: error retrieving current directory: getcwd: cannot
access parent directories: No such file or directory

Sending the command not into background with an ampersand avoids this
error, but I'm looking for something which triggers on an external
script and mimedefang should not wait for its finishing.

Ciao!
Marcus

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang