Unix Technical Forum

Send print job via e-mail

This is a discussion on Send print job via e-mail within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi all, I try to implement a custom backend to the AIX printing system which is supposed to send ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 07:20 AM
Torsten Schlabach
 
Posts: n/a
Default Send print job via e-mail

Hi all,

I try to implement a custom backend to the AIX printing system which is
supposed to send the print job via e-mail to the user who has submitted
it.

I have figured out this line in the backend script:

/usr/bin/cat $@ | /usr/sbin/sendmail $USER@mydomain.com

If I put a fixed username in $USER it works as expected. So my question
would be: Can I find out the name of the user how submitted the
printjob? I guess I should be able to, I just don't know where to
search.

Any hints welcome ...

Regards,
Torsten

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 07:20 AM
Jurjen Oskam
 
Posts: n/a
Default Re: Send print job via e-mail

On 2005-09-01, Torsten Schlabach <tschlabach@gmx.net> wrote:

> /usr/bin/cat $@ | /usr/sbin/sendmail $USER@mydomain.com


1) This is a Useless Use of Cat (tm), it's better to use:

/usr/sbin/sendmail $USER@mydomain.com < "$@"

2) To test whether the username is set in an environment variable, do
something like:

export | /usr/sbin/sendmail you@yourdomain.com

... and read the mail to see if the username is in there.

--
Jurjen Oskam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 07:20 AM
 
Posts: n/a
Default Re: Send print job via e-mail

> I try to implement a custom backend to the AIX printing system which is
> supposed to send the print job via e-mail to the user who has submitted
> it.
>
> I have figured out this line in the backend script:
>
> /usr/bin/cat $@ | /usr/sbin/sendmail $USER@mydomain.com
>
> If I put a fixed username in $USER it works as expected. So my question
> would be: Can I find out the name of the user how submitted the
> printjob? I guess I should be able to, I just don't know where to
> search.


If you're able to do this in C instead of a shell script, there are some
calls you can make to get the print job submitter from qdaemon:

log_init(); /* Initialize communication with qdaemon */
get_from(); /* Get the print job submitters user name from qdaemon */

Best regards,
Paul



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-05-2008, 07:20 AM
Hajo Ehlers
 
Posts: n/a
Default Re: Send print job via e-mail

If you are lucky the process has still the effective user id. So i
would check what the command

/usr/bin/id -un

shows.

So for testing

/usr/bin/id -un >> /tmp/guelle.muelle

hth
Hajo

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com