1751921 Members
4896 Online
108783 Solutions
New Discussion юеВ

LPDEST

 
SOLVED
Go to solution
Yarok
Regular Advisor

LPDEST

Hello,

I would like to edit the spooler destination.

I know that LPDEST from env is the place to make the change.

1. Is there a possible to edit the env itself (i guess not, but just to be sure).

2. How can I set env parameters?

3. where can I define the spooler destination?

BR,

Yaron

9 REPLIES 9
Bill Hassell
Honored Contributor

Re: LPDEST

On any server with multiple printers, there should never be a default destination printer (lpadmin -d) because someone will complain that it is not the printer they want to use. So make sure there is no default printer (lpstat -d). Then for each user, add the desired printer name in $HOME/.profile like this:

export LPDEST=prn32

Now, this user will automatically print to prn32.

On the other hand, if you only have one printer, just use the command:

lpadmin -dprn678

and now, all users will print to the same printer without having to use the lp -d option.


Bill Hassell, sysadmin
Matti_Kurkela
Honored Contributor
Solution

Re: LPDEST

LPDEST is an environment variable.

"env" is not a file or a place: it is one of the many ways to display all the environment variables that are currently set.

To see all the configured spooler destinations, run "lpstat -p". The output should look like this:

$ lpstat -p
printer foobar is idle. enabled since Jan 28 15:00
fence priority : 0

In the above example, there is only one spooler destination, "foobar".
If you want to configure more spooler destinations (= printers), use SAM/SMH, or commands "lpadmin" or "addqueue" (for network printers only).

To set environment variables like LPDEST, you first need to know which shell you're using. The command "echo $SHELL" might be helpful here.

If you're using tcsh or csh (yuck), you can set/overwrite environment variables with commands like:

setenv VARIABLE value
i.e.
setenv LPDEST foobar

If the variable already exists, the new value will overwrite the old one automatically.

To unset (remove) a variable with tcsh or csh:

unsetenv VARIABLE


With most other shells (i.e. the Bourne/POSIX-style shells) like sh, ksh, bash and zsh, the commands are slightly different.

In these shells, there are two common ways to set an environment variable:

VARIABLE=value
export VARIABLE

or

export VARIABLE=value

To unset(delete) an environment variable in Bourne/POSIX-style shells:

unset VARIABLE


The environment variables are specific to each process. A child process receives a copy of its parent's environment variables at the moment of its creation.

(That is, assuming the variable is *exported*: in csh/tcsh, all environment variables are exported by default. In Bourne/POSIX shells, if the "export" command is not used, the variable will not be copied to the environment of the child processes; it will be available for the shell itself only.)

Each process can only change its own environment variables.

The environment variables are not persistent: if you set them in your login session and then log out, you'll need to set them again in your next session. To set an environment variable persistently, you'll need to add a command to set the variable in your login script, so that the variable will be automatically set as you want it each time you log in.

MK
MK
Yarok
Regular Advisor

Re: LPDEST

Many thanks for complete answers.

I know you all avoid of working with tcsh but this is the shell running here.
(This is due to comfortable environment reasons for users, such as up arrow for last command) hence setenv (so does export) is not available.

The users use a print script called sps which defines the $LPDEST for pe2 printer.

So, how and where can I set LPDEST (script; env).

I attached the script as well.

BR,

Yaron.
Dennis Handly
Acclaimed Contributor

Re: LPDEST

>hence setenv (so does export) is not available.

Of course setenv is available, you are using the scummy C shell or its improved derivative, tcsh.

This script assumes that LPDEST has already been exported before you invoke it.

So as MK said, you can export it in your scummy C shell ~/.login profile:
setenv LPDEST some-printer

Or the user can invoke that setenv in his session, sometime before printing.
Steven Schweda
Honored Contributor

Re: LPDEST

> [...] tcsh [...] (This is due to
> comfortable environment reasons for users,
> such as up arrow for last command) [...]

http://www.gnu.org/software/bash/
http://hpux.connect.org.uk/hppd/hpux/Shells/bash-4.2/
Yarok
Regular Advisor

Re: LPDEST

Thank you for your replies.

Dear Steven,

I would like to download bash from the link you sent http://hpux.connect.org.uk/hppd/hpux/Shells/bash-4.2/) for 11.11v.

It is with .gz extension.

Should I copy it to /sbin and istall it there? How to Install?
BR,

Yaron
Steven Schweda
Honored Contributor

Re: LPDEST

> It is with .gz extension.

This is pretty common knowledge. Did you try
anything simple like a Web search for, say,
.gz
? Google works for me. Or:
man gzip

Or the FAQ link at the top of that Web page?

http://hpux.connect.org.uk/hppd/answers/

[...]
4. SOURCE PACKAGE DISTRIBUTIONS
4.1 How do I unpack the sources?
[...]

http://hpux.connect.org.uk/hppd/answers/4-1.html

If this remains a mystery, then you might try
to find some local help.
Steven Schweda
Honored Contributor

Re: LPDEST

Also, ...

> Should I copy it to /sbin [...]

No.

Normally, anyone who has the "root" password
should already know these things. Or be
reading much more about HP-UX (or UNIX in
general) then he'll find in answers here.
Yarok
Regular Advisor

Re: LPDEST

Dear Steven,

Handling with .gz is well known. That was not the issue.

Obviously, I am not the scholar sys admim and I just try to learn the matter.

I probably should go back to the books. Thank you for your help.

BR,

Yaron