enq Command
Purpose
Enqueues a file.
Syntax
To process a file
enq [ - ] [ -B CharacterPair ] [-c ] [ -C ] [ -G ] [ -j ] [ -m Text ] [ -M File ] [ -n ] [ -N Number ] [ -o Option ] [ -P Queue ] [ -r ] [ -R Number ] [ -t "User" ] [ -T Title ] [ -Y ] [ -Z Name ] File
To change the priority of print jobs
To display status
enq [ -q | -A ] [ -L ] [-W ] [ -e ] [ -# JobNumber ] [ -u Name ] [ -w Seconds ] [ -s]
To change queue and queue daemon status
enq [ -d ] [ -D ] [ -G ] [ -K ] [ -L ] [ -q | -A ] [ -U ]
To cancel options
enq [ -X ] [ -xNumber ] [ -PPrinter ]
To hold, release, or move a print job to another queue
enq { -h | -p | -Q NewQueue } { -# JobNumber [ -P Queue ] | -u User | -P Queue }
To queue and hold a print job
enq -H File ...
Description
The enq command is a general-purpose utility for enqueuing requests to a shared resource, typically a printer device. Use the enq command to enqueue requests, cancel requests, alter the priority of a request, and display the status of queues and devices.
The enq command has five different syntax diagrams because all the flags are not meant to work together. Some of these flags are meant for file processing and accept FileName as an option. The other flags are used for changing the priority of a print job, displaying the status, changing the status of the queue or the queue daemon, and canceling a print job.
To enqueue files on a specific queue, use the -P flag (-P Queue). If more than one device services a queue, you can also request a particular device by specifying that device (:device) after the name of the queue. If you do not specify a device, the job is sent to the first available device. If you do not specify a file, the enq command copies standard input into a file and enqueues it for printing.
The enq command requests can have operator messages that are associated with them. This feature is useful in a distributed environment or on a system with many users. The messages are used to tell the printer operator such information as a request to load a special form or different color paper into the printer before allowing the job to print. These messages are specified with the -m and -M flags. The qdaemon command processes the enq command requests. When the qdaemon is ready to begin a request that has an associated message, the system displays the message on the console of the machine where the qdaemon process is running. The text of the message is accompanied by a prompt that tells the printer operator how to signal the request to continue or how to cancel the request.
The display that is generated by the enq -A command contains two entries for remote queues. The first entry contains the client's local queue and local device name and its status information. The second entry follows immediately; it contains the client's local queue name (again), followed by the remote queue name. Any jobs that are submitted to a remote queue are displayed first on the local side and are moved to the remote device as the job is processed on the remote machine.
Since the status commands communicate with remote machines, the status display might occasionally appear to hang when waiting for a response from the remote machine. The command eventually times out if a connection cannot be established between the two machines.
- Before you can enqueue a file, you must have read access to it. To remove a file, (see the -r flag) you must also have write access to the directory that contains the file.
- If you want to continue changing the file after you issue the enq command but before it is printed, you must use the -c flag.
- When enqueuing files on a printer, flags can be interspersed in any order.
- The -d and -G flags are acted upon immediately. Syntax error that appears before these flags on the command line are reported. Syntax errors that appears after these flags on the command line are ignored.
Flags
File processing options
If you give the enq command a list of file names, it enqueues them all for file processing on the default device or on the specified device.
Item | Description |
---|---|
- | Causes the enq command to act as a filter. The enq command automatically reads standard input if you do not specify a file or files. However, if you do specify a file, you can also use the dash (-) to force the enq command to read standard input. The dash (-) is actually not a flag, but a special type of file name. Therefore, it must come after all other flags are specified on the command line. |
-B CharacterPair | Controls the printing of burst pages according to the value
of CharacterPair as follows. (n = never, a =
always, g = group. The first character is for header, the second
character is for trailer.)
The header and trailer stanzas in the /etc/qconfig file define the default treatment of burst pages. Note: In a remote
print environment, the default is to print a header page and not a
trailer page.
|
-c | Copies the file. To save disk space, the enq command remembers the name of the file, but does not actually copy the file itself. Use the -c flag if you want to continue changing the file while you are waiting for the current copy to be printed. |
-C | Specifies that the mail command
is to be used instead of the write command
for error messages and job completion notification. (Using this flag
is useful for writing PostScript applications
since it allows better feedback from the printer.) Error messages
and job completion messages (both generated by the piobe command)
and any data read from the printer are also sent back by mail. The -C flag applies only to local print jobs. If you want to be notified when a job sent to a remote printer is completed, use the -n flag to receive a mail message. Note: There
are some messages that cannot be redirected from qdaemon and
the printer back-end in any way. These messages are system errors
and are sent directly to the /dev/console file.
|
-j | Specifies that the message Job number is: nnn, where nnn is the assigned job number, be displayed to standard output. It occurs only if the job is submitted to a local print queue. |
-m Text | Submits an operator message with an enq command request. The specified text contains the message. |
-M File | Submits an operator message with an enq command request. The specified file contains the text of the message. |
-n | Notifies you when your job is finished. If the -t flag is also used, the enq command also notifies the user for whom the request is intended (see the -t flag). |
-N Number | Prints Number copies of the file. Normally, a file is printed only once. |
-o Option | Specifies that flags that are specific to the backend be passed to the backend. Thus, for each queue there are flags that are not described in this section that can be included on the enq command line. See the piobe command for a list of these flags. |
-P Queue | Specifies the queue to which the job is sent. A particular device on a queue can be specified by typing -P Queue:Device. |
-r | Removes the file after it is successfully printed. |
-R Number | Sets the priority of the current job to Number. This flag is used at job submission time. Use the -a flag to alter priority after the job is submitted. Higher numbers assign higher priority. The default priority is 15. The maximum priority is 20 for most users and 30 for the users with root user authority. |
-t "User" | Labels the output for delivery to User. Normally the output is labeled for delivery to the user name of the person who is issuing the enq command request. The value of User must be a single word that meets the same requirements of a regular user ID. |
-T Title | Puts title on the header page and displays it when the -q flag is specified. Normally the job title is the name of the file. If the enq command reads from standard input, the job title is STDIN.# where # is the process ID of the enq command. |
-Y | Tells the enq command to ignore the rest of the command line after this flag. This is useful for discovering whether a queue is valid (if it is in the /etc/qconfig file). For example, typing enq -P lp4 -Y returns with an exit value of 0 if the line printer lp4 is a valid queue; if otherwise, a nonzero value is returned. Using this flag is also good for forcing the qdaemon command to redigest the /etc/qconfig file. |
-Z Name | Specifies originator of remote print jobs. |
Print job priority options
Item | Description |
---|---|
-a Number | Changes the priority of the named job to Number. The job must be submitted for printing before entering the enq command with this flag. See the -R flag for a description of priorities. Use the -# flag to specify the job number. This flag is only valid for local print jobs. |
-# JobNumber | Specifies the job number that is used by the enq -q command or the enq -a command, and
displays only the job that is specified in status output. Note:
|
Display status options
Item | Description |
---|---|
-A | Provides status for all queues. It is like running the enq -q command once for each queue in the qconfig file. |
-e | Excludes status information from queues that are not under the control of the qdaemon command. The status from such queues might be in different formats. The -e flag can be used with any combination of flags. |
-L | Specifies the long status. This flag can be used with the -A, -q, or -W flag. If the -L flag and the -W flag are used simultaneously, the result displays the long status of the print job in the semicolon-separated format. Use the -L flag to show multiple files to be printed in a single print job. |
-q | Displays the status of the default queue. The LPDEST and PRINTER environment
variable control the name of the default printer. If the LPDEST environment
variable contains a value, that value is always used first. If the LPDEST variable
has no value, the enq command uses the PRINTER environment
variable. If the PRINTER environment variable contains no value,
then the enq command uses the system default. Notes:
|
-s | Obtains the status of print queues without listing any files. |
-u Name | Specifies the user name for which to print job status. |
-w Seconds | Specifies continuous output of the queue status, updating the screen every Seconds specified until the queue is empty (see the lpq command). When the queue is empty, the process halts. This flag is only used with either the -q flag, or the -A flag, or the -L flag. |
-W | Specifies the wide status format with longer queue names, device names, and job numbers. This flag can be used with the -A, -q, or -L flag. If the -L and -W flags are used simultaneously, the result displays the long status of the print job in the semicolon-separated format. |
Change the queue and queue daemon status options
Item | Description |
---|---|
-d | Runs the digest command on the /etc/qconfig file. Once the digest is completed, any changes to the /etc/qconfig file are reflected in the /etc/qconfig.bin file. A user must have root user authority to run this option. |
In addition to the previous flags available to all users, the enq command accepts the following flags when they are entered by users that have root user authority. Root user authority means that you are root or you belong to the printq group.
Item | Description |
---|---|
-D | Device DOWN. Turns off the device that is associated with the queue. The qdaemon process no longer sends jobs to the device, and entering the enq -q command shows its status as DOWN. Any job currently running on the device is allowed to finish. |
-G | Die GRACEFULLY. Ends the qdaemon process after all
currently running jobs are finished. Use of this flag is the only
clean way to bring the qdaemon process down. Use of the kill command might cause problems, such
as jobs hanging up in the queue. If the qdaemon process is running under srcmstr (the default configuration), enq -G does not prevent qdaemon from being restarted automatically. You must use the chssys command, which changes the default configuration and prevents the automatic restart of the qdaemon process. The following command:
issued before the enq -G command, prevents the automatic restart of the qdaemon command. The following command:
restarts the qdaemon process manually. |
-K | Acts the same as the -D flag, except that all current jobs are killed. They remain in the queue, and are run again when the device is turned on. |
-L | Specifies the long status. This flag can be used with the -A, -q, or -W flag. Use the -L flag to show multiple files to be printed in a single print job. |
-U | Brings UP the device that is associated with a queue. The qdaemon process sends jobs to it again and entering the enq -q command shows its status as ready. |
Cancel options
Item | Description |
---|---|
-X | Cancels the printing of your jobs. If you have root user authority, all jobs on the specified queue are deleted. This flag is only valid on local print jobs. |
-x Number | Cancels the printing of the specified job Number. |
-P Printer | Specifies the Printer where either all jobs or the selected job number is to be canceled. |
Holding and releasing a print job options
Item | Description |
---|---|
-# JobNumber | Designates the number of the print job to be held or released. |
-h | Holds the specified print job. |
-H | Queues and holds the file indicated with the File parameter. |
-p | Releases the specified print job. |
-P Queue | Designates the print queue to be held or released. |
-u User | Designates the user whose print jobs are to be held or released. |
Moving print job options
Item | Description |
---|---|
-# JobNumber | Designates the number of the print job to be moved. |
-P Queue | Designates the print queue to be moved. The value of the Queue variable can be a queue name or in the form queue:device name. |
-Q NewQueue | Designates the target queue where the print job is moved to. The value of the NewQueue variable can be in the form of a queue name or in the form queue:device name. |
-u User | Designates the user whose print jobs are to be moved. |
Security
Auditing Events:
Event | Information |
---|---|
ENQUE_admin | Queue name, device name, job name, user name |
Examples
- To print the file memo on
the default printer, enter:
enq memo
- To print the file prog.c with
page numbers, enter:
The pr command puts a heading at the top of each page that includes the date that the file was last modified, the name of the file, and the page number. The enq command then prints the file.pr prog.c | enq
- To print a file with
page numbers, reading from standard input, enter:
The dash
(-) special file name tells the enq command to read
from standard input. Normally the enq command does not read
from standard input if there are file names on the command line. It
also indicates the order in which to print things. The pr command
creates a page numbered version of the file x and passes
it to the enq command, which creates a temporary file that
contains that output in the /var/spool/qdaemon file.
The enq command creates a job with four files and submits it to the queue named bill. It prints the fn1 file twice. Then, it prints whatever the output of the pr command was. Lastly, it prints the file fn3. The four files are treated as one job for the purposes of burst pages. Notification is sent (the -n flag) when the job is complete. Since the -r flag was specified, the fn1 and fn3 files are removed at job completion. The temporary file that is created by the dash (-) file is always deleted.
The pr command puts a heading at the top of each page that includes the date that the file was last modified, the name of the file, and the page number. The enq command then prints the file.
- To print the file report on the next available printer
that is configured for the fred queue, enter:
enq -P fred report
- To print several files that begin with the prefix sam on
the next available printer that is configured for the fred queue,
enter:
All files that begin with the prefix sam are included in one print job. Normal status commands show only the title of the print job, which in this case is the name of the first file in the queue unless a different value was specified with the -T flag. To list the names of all the files in the print job, use the long status command enq -A -L.enq -P fred sam*
- To check the print queue to see whether a file is still waiting
to be printed, enter: enq -qThis command displays the status of the user's default queue. If the file is not yet printed, then it appears in the queue status listing. The system default queue is defined as the first queue in the /etc/qconfig[.bin] file. Users can have their own default override by setting and exporting the PRINTER environment variable.
- To display the status of a nondefault queue, lp0, enter:
- To obtain the long queue status, enter: enq -L
- To obtain status on all queues, enter: enq -A
- To obtain long status on all queues, enter:
- To obtain the status of the default queue, in wide format, enter:
enq -W
- To obtain the wide status of all queues, enter:
- To stop printing a job (a job is one or more files), enter: enq -x 413This command cancels the request that you made earlier to print a job. The number was obtained from the listing that is obtained by entering the enq -q command. If the job is being printed, the printer stops immediately. If the job is not printed yet, it is removed from the queue so that it is not printed. If the job is not in the queue, the enq command displays a message similar to the following output:
no such request from you -- perhaps it's done?
- To disconnect a printer from the queuing system, enter:
Entering this command
stops the enq command requests from being sent to the printer
that serves the lp0 queue. If a file is printing, it is allowed
to finish. You must be able to run the qadm command to run
the enq command. Note: The printers that serve a specified queue are named by the device stanza name as it appears in the /etc/qconfig[.bin] file.
- To print a file with page numbers by using the piobe command
backend on the default printer, enter: enq -o -p filenameThe -p flag is not looked at by the enq command. The -o flag tells the enq command to pass the next item, which can be in quotes, to the backend unchanged. So, the enq command passes the -p flag to the qdaemon process, which in turn passes it to the backend piobe. The -p flag causes piobe to run the /usr/bin/pr filter to apply page numbers to the document before giving data to the device. Multiple options can be given in quotes preceded by one -o flag. Multiple options can also be given without quotes with each option preceded by the -o flag.
- Assuming a qconfig file with the following information:
And given the following commands: The qdaemon process runs the /usr/bin/diff program with two arguments, one of which is a temporary file name and the other being the /etc/hosts file. The only difference between the two files is that one was run through the pr command. The /tmp/hello file contains the differences between the two files. The qdaemon process does not create the /tmp/hello file if it does not exist.qname: device = fred fred: file = /tmp/hello backend = /usr/bin/sh /usr/bin/diff
- The following command: enq -m'i want pink paper for this job' /etc/passwdsends the specified operator message to the operator's console just before the print job is to print. The operator must respond to this message to continue or cancel the job.enq -M pink /etc/passwdThis command accomplishes the same thing, only the message is contained in a file called pink.
- To cancel all jobs in the fred queue, enter: If the user who entered this command has root user authority, all the jobs from the fred queue are deleted. If the user does not have root user authority, only the users jobs are deleted from that queue.
- To queue the file named MyFile and return the MyFile job
number to the jdf file, enter: enq -j MyFile
- To hold print job number 310, enter:
To release the
hold on print job number 310, enter: enq -p -#310
- To hold all the print jobs on queue lp0, enter:
To release the lp0 queue,
enter: enq -p -P lp0
- To hold all print jobs that are created by fred, enter:
To release the
print jobs that are created by fred, enter: enq -p -u fred
- To move job number 318 to queue lp0, enter: The flags that control moving print jobs work in the same way as the flags that hold the print files. The hold flags and variables are illustrated in the preceding examples.
Files
Item | Description |
---|---|
/usr/sbin/qdaemon | Queuing daemon. |
/etc/qconfig | Queue configuration file. |
/var/spool/lpd/qdir/* | Queue requests. |
/var/spool/lpd/stat/* | Information about the status of the devices. |
/var/spool/qdaemon/* | Temporary copies of enqueued files. |
/etc/qconfig.bin | Digested, binary version of the /etc/qconfig file. |