- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Using Cron to Print Mail automatically
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:00 AM
08-06-2003 09:00 AM
Using Cron to Print Mail automatically
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:05 AM
08-06-2003 09:05 AM
Re: Using Cron to Print Mail automatically
0,15,30,45 * * * * lp -d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:06 AM
08-06-2003 09:06 AM
Re: Using Cron to Print Mail automatically
0,15,30,45 * * * * lp -d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:18 AM
08-06-2003 09:18 AM
Re: Using Cron to Print Mail automatically
if [ -s $mailfile ]
then
INSERT COMMANDS IN HERE
fi
As far as reading and printing, you can use readmail(1) to read through a list of mails and quit when you get to the end of the list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:40 AM
08-06-2003 09:40 AM
Re: Using Cron to Print Mail automatically
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 09:54 AM
08-06-2003 09:54 AM
Re: Using Cron to Print Mail automatically
lp $MAILBOX
mv $MAILBOX $MAILBOX.old
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 10:02 AM
08-06-2003 10:02 AM
Re: Using Cron to Print Mail automatically
accessing the mailbox you'll see a partial
message. If a message is deleted while your
cron job is accessing the mailbox you might
corrupt the mailbox! Mail clients like elm
typically use file locking to prevent mailbox
corruption and to make sure you only see
complete messages.
You're probably better off doing this sort
of thing from sendmail itself, and not from
cron. Either use an alias or a .forward file
(see aliases(5)). Example alias:
some_user: \some_user, "| lp -dsome_printer"
This will print each message as it's
received. It will also save the message
to the mailbox as usual. If you don't want
the message to be saved to the mailbox, use:
some_user: "| lp -dsome_printer"
If you want to process the message to
strip off the headers & whatnot, use a
script in the alias:
some_user: "| my_script | lp -dsome_printer"
If you really want to batch the print jobs
up, you can use an alias to save the messages
to another file, and have a cron job print
that file every 15 minutes. You'll still
have to deal with some sort of locking,
though.
HTH