![]() |
| April 2000 | Get BSD | New to BSD? | Search BSD | Submit News | FAQ | Contact Us | Join Us |
|
This time we bring you several more of the questions that pop up very often on the mailing lists and BSD newsgroups--oh, and the answers with commentary in some depth.
More coming soon to this website direct to you. And next column, maybe a pleasant surprise!
How do I enforce automatic logout after specified amount of time?
How do I print out man pages so I can go in a corner and read them?
How can I set up my console screen to do 80x50? I'm tired of seeing the standard 80x24 lines.
Q: Is there an easier way to uuencode and mail gzip'd
tarballs than:
A: Sure, and one that fits your example case might be to use the power
of pipes with redirection. Here is a one-liner:
There are examples of using uu{en,de}code in the uuencode(1) man
page. Say that you want to send a friend your sample project code at
a distant site and haven't got an ftp path to reach him, or just want a
one-liner. After you have cd'd to your project directory, this will
automate the task.
Q: My power has gone out unexpectly in recent days. How can I automate my BSD system to auto-sync my disks, say, every few seconds... just in case?
A: In FreeBSD, this is one for /sbin/sysctl, the utility that lets you
retrieve or set many things in the BSD kernel.
To update the sync time, as root
will sync the disks every three seconds.
sysctl lets the root user fine-tune the system. sysctl retrieves and
lets root alter a wide range of things such as the number of processes
to a given user or the number of open file per user (ID) or the open
files per process.
Typing
will give you more details.
OpenBSD doesn't have such a knob. The sched_sync ('update') kernel
thread syncs a filesystem once every second, unless you are running
with soft updates in which case it syncs continuously. This behaviour
is negated by mounting a filesystem with the 'async' option.
The interesting question is why your reliability experience with
Linux/ext2fs has been better than with *BSD/ffs. Perhaps this extract
exlpains it:
BSD-like synchronous updates can be used in Ext2fs. A mount
option allows the administrator to request that metadata (inodes,
bitmap blocks, indirect blocks and directory blocks) be written
synchronously on the disk when they are modified. This can be
useful to maintain a strict metadata consistency but this leads
to poor performances. Actually, this feature is not normally
used, since in addition to the performance loss associated
with using synchronous updates of the metadata, it can cause
corruption in the user data which will not be flagged by the
filesystem checker.
(Full paper)
In BSD, the ffs performance loss associated with synchronous mounts
(the default) can be reduced by either mounting with the 'async' option
(which can lead to more corruption) or enabling soft updates on your
file system. See the tunefs(8) manual page for details on turning it on.
See also
http://www.mckusick.com/articles.html
Q: What do the directory abbreviations
stand for?
A:
In days of yore, physical paper books, collectively called the Manual,
accompanied Unix releases. It consisted of the smm, psd, usd and all the
manual pages accessible with man(1).
The smm/psd/usd directories are intended to contain the source code to those
parts of the Manual. These days, most manual searches are performed online,
and the format of the smm/psd/usd documents are not as amenable
as the manual pages are. Because of their reduced profile, they
are poorly maintained in the *BSD world and so tend to be treated as
historical documents rather than working documentation.
Q: How do I enforce automatic logout after specified amount of time?
A: FreeBSD sets this in /etc/login.conf, with the :idletime directive.
To set an idletime maximum of 30 minutes, assuming the users you want to
logout after 30 minutes are dialed in, set the
line under
the PPP/SLIP connections section.
Of course idletime and sessiontime are different things, so if you want
to limit all users to, say 8 hours and 30 minutes, under the same section
you would set
Do a
for details. It's worth noting that /etc/login.conf is one of those
almost-endlessly configurable sysadmin features.
OpenBSD does not have such burdensome rules. Instead,
the reader is referred to the /etc/ppp/options or the idled port;
/usr/ports/sysutils/idled.
Q: How do I print out man pages so I can go in a corner and read them?
A: First of all, you will need to find the file that contains the
manual page `source'. You can find it by giving the -w option to man(1).
Note that on some systems, manual pages are installed preformatted ASCII
and/or compressed, and these will appear as `cat' pages:
A slight diversion on cat pages is in order:
Cat pages are plain text files with backspace sequences that achieve overstrike,
(bold) and underline on a dot-matrix or line printer. For example to print
a bold 'B', you would send to the printer 'B', backspace and then the 'B' again.
The online paging programs, more(1) and less(1), understand the
backspace sequences and simulate overstrike and underlining when you view
the manual page.
However, we need the manual page source to the cat pages. For the ls
cat page named above, the corresponding 'man' page should be located at:
If you don't have this form of the file, then you will find it hard to
print out the documentation on anything except a line printer.
Assuming you found the man page source, you can now convert it into one
of many types of outputs. For example, to generate postscript output,
use the -T (type) and -mandoc flags to groff in the following incarnation:
You can then send this file to your postscript printer with lpr.
$ uuencode saveconfig.gz saveconfig.gz > saveconfig.uu
$ mail -s saveconfig.uu smith@save.com < saveconfig.uu ?
% uuencode saveconfig.uu < ./saveconfig.gz | mail -s saving smith@save.com
% tar -zcf - . | uuencode proj.gz | mail -s proj.gz friend@some.edu
# sysctl -w kern.update=3
# man 8 sysctl
/usr/share/doc/smm
/usr/share/doc/psd
/usr/share/doc/usd
smm is for the System Manager's Manual
psd is for the Programmer's Supplementary Documents
usd is for the User's Supplementary Documents
":idletime=30m:"
":sessiontime=8h30m:"
% man login.conf
% man -w ls /usr/share/man/cat1/ls.0.gz
/usr/share/man/man1/ls.1
% groff -Tps -mandoc /usr/share/man/man1/ls.1 > ls.ps