COMPUTER AND NETWORK SYSTEM ADMINISTRATION Summer 1996 - Lesson 29 Miscellanous Topics I. Cron - Used to schedule execution of shell scripts and programs - Managed by "/usr/etc/cron" (SunOS) or "/usr/sbin/crond" (Linux) - Typical cron daemon has a 60-second clock resolution for timing - The cron daemon checks various files for the list of commands to run. Location is cron-dependent: BSD-based: /usr/lib/crontab or /etc/crontab AT&T-based: /usr/lib/crontabs, /var/spool/cron/crontabs, etc. Vixie cron: a nice AT&T cron clone (Linux) - Luckily, the format of the crontab(5) file is universal (p. 173): Six-field version: minute hour day month day-of-week command string 0-59 0-23 1-31 1-12 1=Mon, 2=Tues Seven-field version: minute hour day month day-of-week user command string 0-59 0-23 1-31 1-12 1=Mon, 2=Tues Wildcards and ranges are permitted: * = any time single integer = exact time comma list integers = list of exact times integer dash integer = range of times Examples: 15 3 * * * find / -name .nfs\* -mtime +7 -exec rm -f {} \; -o -fstype nfs -prune 5 4 * * 6 /usr/lib/newsyslog >/dev/null 2>&1 45 10 * * 1-5 wall "it is 10:45 AM on a weekday" 45 * * * * /usr/local/bin/killidle -t720 > /dev/null 30 5 * * * /bin/calendar - - To edit BSD-style cron jobs, edit the file directly then SIGHUP the cron daemon. - On an AT&T-style cron, use the "crontab" command: crontab -l # list a user's crontab file crontab -e # edits a user's crontab file using $VISUAL or $EDITOR crontab -r # remove a user's crontab file "crontab -e" brings up your current crontab file; you edit a copy; it replaces the system copy after you exit -- the cron daemon is sent a signal on a named pipe to re-read your file. - AT&T has separate crontab files per user in the "crontabs" directory. Permission to use "crontab" is specified in "cron.allow" and "cron.deny" (book notes the files can be squirreled away in a number of places, such as /var/spool/cron). "Out of the box" UNIXes typically only permit "root" to have crontab entries. - A useful "watered down" version of background tasking can be done with the "at" commands. - "at" gives you a one-time shot at running a shell script (or job). Linux has a series of commands that permit management of these jobs (at, batch, atq, atrm). Scheduling of the "at" jobs occurs using the same cron daemon. - Files "at.deny" and "at.allow" usually exist as well, to give people the ability to use the "at" commands. - Common cron tasks: o Unattended backups o Environmental monitors (network, A/C, power, etc.) o Network management (sharing system files via "rdist") o Skulker scripts o Idle reapers o Accounting tasks o Log management (syslog, web logs, etc.) o Calendar feature: /bin/calendar - For full-featured batch subsystems, install either public domain or commercial packages, such as: Network Queuing System (NQS) Distributed Queuing System (DQS) -- Used & developed at SCRI LoadLeveler (IBM) II. USEnet News - "The BBS system of the Internet" - undoubtably the largest bulletin board system in the world o Requires a news server to be set up with "news feeds" from other news servers o Notes are distributed in a fan-out fashion, with a protocol for discarding already-received notes o A busy news server can push 100s of megabytes a day Example : news.fsu.edu, news.scri.fsu.edu Try : "telnet news.fsu.edu nntp" (nntp = port 119) o The dominate method for mass-scale communication prior to the Web (still has a healthy existance). - Terms: o newsgroup = collection of notes of a particular topic o article = note body o post = submit an article to a set of newsgroups o NNTP = Network News Transfer Protocol o FAQ = Frequently Asked Questions o moderation = unmoderated newsgroups permit anybody to post; moderated newsgroups send email to the moderator instead, who then posts o subscribe = tell your client software to grab articles only for a subset of the thousands of newsgroups. o expired = articles that are automatically removed after some period of time, to free up disk space for newer articles o flame = emotional overreaction to a notes article :) o smileys = ASCII-based graphics :) :O ;) - Newsgroup hierarchy o Not unlike the DNS hierarchy, but backwards :) (larger domain is on the left: comp.os.ms-windows.networking.windows) o Table 24.1, page 565 lists the top level newsgroup classifications (alt, bionet, biz, clari, comp, k12, etc.). Local newsgroups: "fsu.*" (fsu.jobs, fsu.networking, etc.) Some fun ones: see table 24.5, page 579 Some of my favorites: rec.humor.funny comp.infosystems.* comp.protocols.time.ntp comp.sys.* comp.unix.* comp.sources.* comp.arch comp.security.announce - News readers (USEnet client software) o UNIX-based: readnews (ancient), rn, nn, trn, tin, xrn + Use "~/.newsrc" to keep track of which newsgroups you are subscribed to and what articles you've already read o PC/Mac based: many :) o Netscape Navigator has a built-in news reader - Server software o C-news (successor to B-news :) o NNTP (add-on to C-news for TCP-based news delivery) o InterNetNews (INN) - has built-in NNTP support Most recent & popular; ACNS and SCRI run INN - A true JOY to install - Requires having network neighbors that agree to provide you with a news feed - Requires 1 GB of disk or more for a full feed III. Printing - Two main branches (as usual): o BSD-based (lpd, lpc, lpr, lprm) o AT&T-based (lpsched, lpadmin, lp, etc.) Table 25.1, page 581 gives a mapping of some O/S names to their style of printing (Linux uses BSD-based) - Terms: o spooler - system that manages the print files separately from users (/var/spool/lpd, typically) o dpi = dots per inch; a measurement of printer quality o PDL = Page Description Language; example is PostScript o bitmap = a variety of binary mappings for image data o RIP = Raster Image Processor; converts between PDL and a bitmap o PostScript = most common PDL (from Adobe Systems, Inc.); a text file that usually starts with "%!" o HPGL = Hewlett-Packard Graphics Language; another PDL from another vendor o PCL = HP's Printer Command Language o QuickDraw = Macintosh format; PICT is the bitmap format o roff = run off; ancient formatting package - BSD printing o All user commands (lpr, lpq, lprm) go through a line printer daemon (lpd), which handles the spooling and communication with the actual printers o User submits prints via "lpr" command o "lpr" interrogates the file /etc/printcap for printer names and attributes (printcap = printer capabilities) o Can handle local printers and remote (printer on a different computer or a printer directly connected to the network) o "lpq" used to check status of printer o "lprm" used to remove a print queue entry o "lpc" is a system-admin tool for managing the print queues (permits you to software-disable and re-enable a queue, get printer status, etc.) -- See pages 596 through 598 o The file "/etc/hosts.lpd" provides host-level control over who gets to use your printers. o BSD line printing is an "all or none" system -- if you want to restrict certain printers from certain people or enforce print quotas you must build your own system using /etc/printcap fields. - AT&T printing o More flexible than BSD, but wasn't designed with native networking like BSD; more difficult to initially set up o More commands: See table 25.5, page 600 o Submit prints via "lp" command o Show status with "lpstat" o "lpsched" is the main daemon that supports the spooling of the print jobs o "lpadmin" is a tool that is used to manage the various printer configuration files. There is no central "printcap" file with all the printing information, rather a collection of directories and files in places like /usr/spool/lp o After much effort, you can usually finagle an AT&T print system to interact with a BSD print system - Nice table (25.8) on page 612 that compares the rough equivalences between the BSD and AT&T print commands. - Cute Exhibit A (page 613) that "grades" the two systems. - No matter which system you get, the real work involves getting the vendor-supplied printing software to work with the spooling system. See a short list on pages 613 and 614. - Note that samba permits you to use UNIX-defined printers on Windows systems (and vice versa), while packages such as CAP (the Columbia Appletalk Package) and netatalk permit you to share UNIX and Macintosh printers. In many cases, the maturity and flexibility of Linux machines make them ideal gateway machines between such disparate worlds as Windows and Macintosh -- the biggest problem is having the sysadmin knowledge to know how to connect it all together. IV. Hardware Maintenance - Usually the SysAdmin has to handle all aspects of the computer system, including those that involve (*gasp*) plain old paperwork and phone calls. - Shop around for warranty periods as well as price. - Don't always buy your equipment from one vendor, especially when it comes to additional memory and peripherals. - Practice good grounding techniques when handling static-sensitive parts. - Sometimes a glitch will free up if you "reseat" a board, connector, or a chip. - Some equipment may require PM (Preventative Maintenance) time; cleaning/adjusting equipment before it breaks. - You should buy a hardware maintenance contract whenever you have a fairly expensive piece of equipment where it is too expensive to maintain your own spare parts and/or repair knowledge. You often have choices on the level of maintenance: o On-site 7 by 24: most expensive! o On-site 9-5, weekdays o Next-day swap - Have your vendor contact information handy (the larger ones typically have 1-800 numbers - know the serial numbers of your machines and your customer identification number).