1841378 Members
2663 Online
110179 Solutions
New Discussion

view pinter spool file

 
kevinq_1
New Member

view pinter spool file

Dear all,
I am looking for a script that allows user to view ther own spoolfile in
/var/spool/lp/request/PRINTERNAME
by typing the printjob #

Thanks in advance.
Kevin
7 REPLIES 7
sudhapage
Regular Advisor

Re: view pinter spool file

Hi

If you have some idea about scripting, then you just go through with below link. If possible try to modify it as per your requirment.

http://www.adminscripteditor.com/scriptlibrary/view.asp?id=421

Regards,
Sudhakaran.K
kevinq_1
New Member

Re: view pinter spool file

Thank you for information.
Sorry i did not mension that my system is
HP-UNIX.

Regards,
Kevin
Bill Hassell
Honored Contributor

Re: view pinter spool file

Well, there's the simple way but users always make mistakes so here's a script that checks for everything. I've written a script (attached) that should accomplish your task.

You can modify the "view" portion at the bottom as needed. Note that a simple cat won't be appropriate if the file is 50,000 lines in length, or it may contain special binary sequences. If your users understand vi, you could actually start view (vi in read-only mode).


Bill Hassell, sysadmin
tom quach_1
Super Advisor

Re: view pinter spool file

Thank you-Bill

The script works good if user is root
because in the printer folder "epson"
the permission is 440 and owner by lp:lp
Is there away to allow user to read these files without add them to group "lp"
Regards,
Kevin


Press Enter to list the file..
cat: Cannot open /var/spool/lp/request/epson/dA5620usa_1: Permission denied
Bill Hassell
Honored Contributor

Re: view pinter spool file

Here you go. The first attachment is the revised version of lpview. The next posting has lpcat attached. You can just replace your existing lpview script. It calls a second script called lpview that is run as EUID=lp so the user can read their own job.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: view pinter spool file

Here is the lpcat file. Store it in /etc/lp, then:
chown lp:lp /etc/lp/lpcat
chmod 4755 /etc/lp/lpcat

The lpcat script spends a lot of time checking that this user is allowed to look at the specified print job, turns off traps, and invalidates the SHELL variable. Normally, SETUID scripts are a no-no but in this case, it only changes to lp and doesn't allow any exit by the user. Lots of comments in both scripts.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: view pinter spool file

One last note: lpcat has an 'echo' in front of the logger command. Remove the echo so that attempts to read non-owned files will be logged.


Bill Hassell, sysadmin