LPRng-HOWTO: Running the software

Next Previous Contents

## 10. Running the software

## 10.1 LPRng's little helper: checkpc

The program `checkpc` (check printcap file) is one of the most useful utilities in the LPRng package.

It will read all the configuration files, printcap files and tests whether devices are set up correctly. Optionally, it will also set the permissions for spool directories and device files. Additionally, it will truncate the accounting and log files to a maximum size. Another use for `checkpc` is to remove old entries from queue directories.

For a new installation, you will want to run

    checkpc -f

to set the permissions right. The `-f` flag instructs the program to correct file permissions. If you don't run this as `root`, you'll receive a warning about that fact and any chown(2) calls will (most likely) fail.

The program reports everything it changes. Since it isn't too clever about some things (visit the man page), you should keep an eye on the output, and run it again if needed. If it keeps failing, change the permissions yourself.

These are the permissions of my spool directory:

    drwx--S---   2 lp       lp           1024 Jul 22 21:15 ./
    drwxr-xr-x  16 root     root         1024 May 29 21:55 ../
    -rw-------   1 lp       lp          10222 Jul 23 05:32 acct
    -rw-------   1 lp       lp              0 Feb 14 21:14 control.lp1
    -rw-------   1 lp       lp          10229 Jul 23 05:32 log
    -rw-------   1 lp       lp              5 Jul 22 21:13 lp1
    -rw-------   1 lp       lp           9064 Jul 22 21:15 status.lp1
    -rw-------   1 lp       lp              5 Jul 22 21:13 unspooler.lp1

And this is lpd's master directory:

    drwx--S---   2 lp       lp           1024 May 11 18:44 ./
    drwxr-xr-x  16 root     root         1024 May 29 21:55 ../
    -rw-------   1 lp       lp              0 Feb 18 07:05 lpd.lock.duff
    -rw-------   1 lp       lp              3 Jul 13 22:42 lpd.lock.duff.printer
    -rw-------   1 lp       lp              0 Apr  1 22:40 lpd.log.duff

Later, you will want to use `checkpc` for the daily maintenance of your system. I have this line in user `lp`'s crontab:

    32 5 * * * checkpc -t 10K -A3 -r >/dev/null 2>&1

This job will:

1. truncate all log and accounting files to 10KB (`-t 10K`). Actually, it will keep the last 10K from the file, starting on a complete line.
2. remove all stale files older than three days (`-A3 -r`).

I'm redirecting output to `/dev/null`, because `checkpc` is a little noisy to my taste. (But too noisy is better than too silent :)

## 10.2 Starting the daemon

Now comes the moment of truth: will it work? (I hope so, otherwise it means there are errors here.) Where should I run the daemon?

In order to work, vanilla LPR needs to be run on all computers on the network. This is because a job is first transmitted to the local `lpd`, and then (if needed) to the remote host.

LPRng eliminates the local `lpd` from this chain, and connects directly to the remote daemon (except in the case of a bounce queue). Therefore, you won't need to start a daemon on all machines.

In short: where do you need the daemon? Only on those machines where you have spool directories. Almost there...

These are the last steps in the installation:

- Kill your old lpd/lpsched.
- Start the newly installed lpd program.
- Print a sample file using the new lpr:

      lpr /etc/printcap

If it works, you can remove your old printing software, and change your system startup files to run the new daemon automatically.

Then, read the rest of the documentation to build whatever complex configuration you need.

Next Previous Contents