Linux-Misc Digest #370, Volume #27 Fri, 16 Mar 01 00:13:02 EST
Contents:
Re: how to make a script output required syntax? (Michael Heiming)
Re: Books on Unix Kernel for non-programmer. (Rich Teer)
Re: Path Extraction (Young4ert)
Re: Books on Unix Kernel for non-programmer. (Rich Teer)
Re: script to monitor and kill/restart runaway processes on Linux server (Randy R)
Problem with persistant pop3 connections (JB)
Re: script to monitor and kill/restart runaway processes on Linux server
([EMAIL PROTECTED])
Re: real player 8 (richard noel fell)
Re: PPP dialer that handles dynamic one-time passwords? (Harold Stevens
US.972.952.3293)
Re: script to monitor and kill/restart runaway processes on Linux server (Chris
Coyle)
Re: PPP dialer that handles dynamic one-time passwords? ([EMAIL PROTECTED])
Re: can't kill! ([EMAIL PROTECTED])
Lilo w/ Win98 and RH7, adding Win2k
Re: "Invalid session number or type of track" error during boot (Dances With Crows)
Re: can a serial connection work when keyboard/monitor doesn't? (Dances With Crows)
Re: "telent localhost" failure (wmchan)
help with Linux FreeS/Wan VPN installation (Hung Ngoc Lai)
----------------------------------------------------------------------------
Date: Fri, 16 Mar 2001 01:35:29 +0100
From: Michael Heiming <[EMAIL PROTECTED]>
Subject: Re: how to make a script output required syntax?
T Sutherland wrote:
>
> I am writing a simple script that requires the user to string the names
> of two files after it on the command line:
>
> #script [filename1] [filename2]
>
> How can I get it to test if the user just typed
>
> #script
>
> and then output the preferred syntax (an echo command I type, obviously)?
>
> I've tried
>
> if [ $1 == "" ]
> then
> echo "Syntax: script [filename1] [filename2]"
> exit
> fi
>
> but all I get is
> ./script: [: ==: unary operator expected
>
> when I type in just
> #script
>
> any clues?
Hello,
if they are real (l)users, you could use somthing something as crappy as
this...:-)
if [ "$#" = 2 ]; then
echo -n "checking syntax."; sleep 1; echo -n "." ;\
sleep 1 ; echo -n "."; sleep 1; echo "."
else
echo "Usage: " $0 "<parameter1> <parameter2>"; exit
fi
echo "OK...:-)"
Good luck
Michael Heiming
------------------------------
Crossposted-To:
alt.os.linux,comp.unix.admin,comp.unix.aix,comp.unix.bsd.openbsd.misc,comp.unix.misc,comp.unix.solaris,comp.unix.ultrix
From: Rich Teer <[EMAIL PROTECTED]>
Subject: Re: Books on Unix Kernel for non-programmer.
Date: Fri, 16 Mar 2001 00:36:57 GMT
On Thu, 15 Mar 2001, J.Smith wrote:
> Well as I mentioned, im an system administrator, not a programmer. Knowing
> how *nix works conceptually and how the algorythms work, will be of use for
> performance tuning, as an troubleshooting aid, and be of general use while
> performing my daily sysadmin duties. But because I wont have to actually
> write or read any code, it will be of less value to me to know " a *int from
> an int."
Ah. If performance tunig was what you wanted, why didn't you say?! :-)
Have a look at Adrian Cockcroft's Solaris Perfromance Tuning.
--
Rich Teer
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
------------------------------
From: Young4ert <[EMAIL PROTECTED]>
Subject: Re: Path Extraction
Date: Fri, 16 Mar 2001 00:24:37 GMT
Thomas Zajic wrote:
> On 14/03/01, Young4ert ([EMAIL PROTECTED]) wrote:
>
>> If I want to extract the program name given the fullpath of the
>> program, all I have to do on my LInux machine is the following:
>>
>> ~/tmp> basename /usr/bin/basename
>>
>> and "basename" will return "basename". Nothing is wrong about;
>> however, if I want is the path of the program, i.e. "/usr/bin",
>> what program should I use to extract the path given the program
>> name in fullpath?
>
> man dirname
>
> HTH,
> Thomas
Thank you. This is what I want.
------------------------------
Crossposted-To: comp.unix.admin,comp.unix.misc,comp.unix.solaris
From: Rich Teer <[EMAIL PROTECTED]>
Subject: Re: Books on Unix Kernel for non-programmer.
Date: Fri, 16 Mar 2001 00:44:44 GMT
On Wed, 14 Mar 2001, it was written:
> I have THE MAGIC GARDEN EXPLAINED by Goodhard and Cox. It's about
Agreed (although Solaris Internals is better for Solaris, of course!).
> SVR4, the basis of Solaris. The Bach book is good for BSD.
Bach's book was about SVR3, not BSD. For BSD internals, the best books
are the Design and Implementatiion of BSD UNIX 4.[34], by McKusick, et al.
--
Rich Teer
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
------------------------------
From: Randy R <[EMAIL PROTECTED]>
Subject: Re: script to monitor and kill/restart runaway processes on Linux server
Date: Fri, 16 Mar 2001 00:53:10 GMT
Unfortunately at this time there's no one server that does this on a
regular basis, so I can't monitor what really happens. If I could it
would help alot. Of course these are dedicated servers, not managed
servers, but I'd like to offer some value added service... All I know
if that I get paged when a server isn't pingable, and 99% of the time
it has to be hard rebooted.
We host over 300 servers, so unless we set them up to page someone
when there are load warnings, we can't really monitor them all.
On the Sun servers that we do manage, we have a script that renices
processes like this, I guess it might be an idea to make a similiar
script for the Linux servers, or even better if I could find a script
on the Internet that is Open Source.
On 15 Mar 2001 20:32:47 GMT, Jeremiah DeWitt Weiner <[EMAIL PROTECTED]>
wrote:
>Randy R <[EMAIL PROTECTED]> wrote:
>> I was
>> wondering if anyone could recommend some software or scripts that
>> would keep a Linux server from freezing up because of runnaway
>> processes, etc, or at least lessen the frequency.
>
> When you say "runaway processes", what do you mean? Processes that
>eat all the CPU time? Too many processes that drive the load sky-high? You
>might want to look into ulimit (man bash and search for ulimit) to help
>control things. Alternately, if you have a single process or family of
>processes that's getting all the processor time, you might try nice'ing
>them heavily. It won't stop them from demanding all the processor time,
>but it can make the system more responsive from the point of view of non-
>niced processes (like your shell).
>
>JDW
>
------------------------------
From: JB <[EMAIL PROTECTED]>
Subject: Problem with persistant pop3 connections
Date: 16 Mar 2001 01:07:22 GMT
Reply-To: [EMAIL PROTECTED]
Hi all,
I'm running a mail server with slack 7.0, but updated with 2.4.1
kernel. I encountered a problem yesterday that I haven't seen before. I
had two separate machines connect via in.pop3d, and they never
disconnected ('netstat' and 'ps' showed me this), nor did the mail
clients actually download any mail.
These clients were both Outlook 2000, according to our Windows guy. Our
Win guy returned to the clients, clicked "send/receive" and everything
worked like normal again. I maintain that there was nothing wrong with
my server, and that it was a client issue. Has anyone experienced
anything like this before?
Thanks,
Jerry
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: script to monitor and kill/restart runaway processes on Linux server
Date: Fri, 16 Mar 2001 01:27:36 GMT
Randy R <[EMAIL PROTECTED]> writes:
> Unfortunately at this time there's no one server that does this on a
> regular basis, so I can't monitor what really happens. If I could it
> would help alot. Of course these are dedicated servers, not managed
> servers, but I'd like to offer some value added service... All I
> know if that I get paged when a server isn't pingable, and 99% of
> the time it has to be hard rebooted.
> We host over 300 servers, so unless we set them up to page someone
> when there are load warnings, we can't really monitor them all.
> On the Sun servers that we do manage, we have a script that renices
> processes like this, I guess it might be an idea to make a similiar
> script for the Linux servers, or even better if I could find a
> script on the Internet that is Open Source.
One scalable answer would be to periodically run a cfengine daemon,
and list, in the "processes:" section, toss in the common offenders.
<http://www.iu.hioslo.no/cfengine/>
Note that cfengine runs on all sorts of Unix variations, as well as
Windows NT...
--
(concatenate 'string "aa454" "@freenet.carleton.ca")
http://vip.hex.net/~cbbrowne/multiplexor.html
The average woman would rather have beauty than brains because the
average man can see better than he can think.
------------------------------
From: richard noel fell <[EMAIL PROTECTED]>
Crossposted-To: linux.redhat.misc
Subject: Re: real player 8
Date: Thu, 15 Mar 2001 21:45:42 -0500
Thanks -
Works quite well with those sites requiring realplayer 8.
Bob Tennent wrote:
> On Thu, 15 Mar 2001 10:34:43 -0500, richard noel fell wrote:
>
> >Is there a linux version of real player 8?
>
> http://proforma.real.com/real/player/player.html?\
> src=010314realhome_1,010314rpchoice_h1&dc=316315314
>
> Click on UNIX under "select OS".
>
> Bob T.
------------------------------
From: [EMAIL PROTECTED] (Harold Stevens US.972.952.3293)
Crossposted-To: comp.os.linux.networking,comp.os.linux.security
Subject: Re: PPP dialer that handles dynamic one-time passwords?
Date: Fri, 16 Mar 2001 01:29:22 GMT
In <[EMAIL PROTECTED]>, John Marley:
[Snip...]
>They've issued us all with hardware tokens that generate a dynamic
>password when we enter our PIN. Obviously, I can't put a dynamic password
>into my chat script (can I?) so is there a ppp dialer that automates all
>the modem configuration and dialing bits, but propmts the user for username
>and password?
Here's a kludge I put together for our SecurID cards. You'll likely at
least modify the MODEM designator and probably the "expect" prompt and
reply strings near the bottom of it.
Invoke it; it will wait for you to enter the dynamic password you have
been give by your PIN entry. You can use an optional phone number that
will override the hardwired builtin as an invocation parameter, too.
#!/bin/sh
# Establish barebones Linux PPP link for SecurID Card dialup account
# Passcode interactive shell entry to avoid process list broadcast
# Requires PPP daemon (pppd) and automated modem dialogue (chat)
# Optional shell parameter (default phone number override)
# Note assumed "ername:" and "ssword:" expect prompts; YMMV
# Harold Stevens 14-Apr-2000
# License: GPL
# NO WARRANTY EXPRESSED OR IMPLIED
# Usage (if you call this script "rasdial"): rasdial [phone#]
logid=wyrd # user customizations; your login account id
phone=123-456-7890 # your dialup number
speed=38400 # modem rate
MODEM=ttyS0 # modem device
token=ATDT # standard Hayes tone dialing
pppdcode=pppd # PPP daemon
chatcode=chat # dialing driver
chatfile=$HOME/raschat # dialing script
if [ ! "$1" = "" ]; then phone=$1; fi # alternate phone number option
echo Using $MODEM
echo Enter passcode: # obtain current SecurID passcode
read passcode
if [ "$passcode" = "" ]; then
echo Abort: missing passcode;
exit;
fi
rm -f $chatfile # bootstrap a stealthier chat file
echo -n > $chatfile
chmod 600 $chatfile
cat >> $chatfile << EOF # build chat file and invoke PPP daemon
""
$token$phone
CONNECT
""
ername:
$logid
ssword:
$passcode
EOF
$pppdcode $speed /dev/$MODEM \
connect "$chatcode -v -f $chatfile" \
defaultroute \
noipdefault \
crtscts \
modem
--
Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
Pardon the bogus email domain (dseg etc.) in place for spambots.
Really it's (wyrd) at raytheon, dotted with com. DO NOT SPAM IT.
Standard Disclaimer: These are my opinions not Raytheon Company.
------------------------------
From: Chris Coyle <[EMAIL PROTECTED]>
Subject: Re: script to monitor and kill/restart runaway processes on Linux server
Date: Thu, 15 Mar 2001 20:50:28 -0500
[EMAIL PROTECTED] wrote:
>
> Randy R <[EMAIL PROTECTED]> writes:
> [ ... ]
OK here's another suggestion, slightly off-the-wall:
just set up a cron entry to periodically kill and restart
the process(es) which seem to "runaway".
For a while the email server programs at Sprint had bugs
in them (until I fixed them all ;-) so we were doing just
that - periodically restarting them.
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: PPP dialer that handles dynamic one-time passwords?
Date: Fri, 16 Mar 2001 02:49:58 GMT
[EMAIL PROTECTED] (Harold Stevens US.972.952.3293) writes:
> Here's a kludge I put together for our SecurID cards. You'll likely at
> least modify the MODEM designator and probably the "expect" prompt and
> reply strings near the bottom of it.
The next step is to support stuff like the "Axent Defender." These
are "calculator" devices that do a challenge/response thing.
- You enter your PIN to activate the Defender.
- The PPP server throws a "challenge" at you, a pretty big number.
- You type it into the Defender.
- Defender spits out a "response," which you then type in to the PPP
authentication session.
- If OK, then PPP is off and running, otherwise a fresh
challenge/response occurs...
--
(reverse (concatenate 'string "gro.gultn@" "enworbbc"))
http://vip.hex.net/~cbbrowne/sap.html
"Microsoft is a cross between the Borg and the Ferengi. Unfortunately,
they use Borg to do their marketing and Ferengi to do their
programming." -- Simon Slavin in asr
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: can't kill!
Date: 15 Mar 2001 19:13:26 -0800
Jean-David Beyer <[EMAIL PROTECTED]> writes:
> [EMAIL PROTECTED] wrote:
> >
> > Jean-David Beyer <[EMAIL PROTECTED]> writes:
> >
> > > Tommy Tang wrote:
> > > >
> > > > Jean-David Beyer wrote:
> > > > >
> > > > > Tommy Tang wrote:
> > ...<snip>...
> > > > > > When my program run, it opens the /dev/video and
> > > > > > soon it hangs. I try to kill that process but it
> > ...<snip>...
> > > > > Your process may be stuck in state D. If this is the case, you are
> > ...<snip>...
> > > > It is really in state D when top-ing. Why the process
> > > > will go to this state? And how to prevent it from going
> > > > to this state?
> > > >
> > > As far as I can tell, this is either because of a kernel software bug
> > > or a hardware bug. The symptom (being in state D) indicates that the
> > > process is waiting for an IO operation to complete, and it never will
> > > complete, either due to the device failing to request an interrupt
> > > indicating trouble or completion, or the hardware or software lost the
> > > interrupt.
> > >
> > > I know of no way out of this other than rebooting.
> > ...<snip>...
> >
> > I remember reading unix (not linux) documentation back in the early
> > 90s that mentioned that a kill signal will not be acted upon until a
> > current IO operation is completed, so if it is a 'bug' it's a long
> > standing one and really a design decision. Shortly after reading this,
> > at my job then, using SCO Unix I believe, a colleague had been trying to
> > do something over a modem line and was complaining his process was hung
> > and he couldn't kill it. We turned off the modem and the process
> > terminated. I don't know if this helps Mr Tang but it suggests that the
> > roots of his problem are pretty deep.
> >
> The same kind of thing happens to me from time to time. Sometimes the
> problem seems to be a disk file, sometimes a tape drive. The disk
> drives are on an Ultra-2 SCSI controller and the tape drive is on a
> separate narrow SCSI controller.
>
> Were I to try to turn something off, I am not sure what it would be,
> since the controllers and drives are all internal. I normally do not
> care to remove the case from my machines when the power is on.
> Furthermore, unplugging the SCSI controllers would probably crash the
> system, so I might as well reboot and not have to deal with a crashed
> system. Bad enough that some device is locked up.
>
I think the idea is that with devices, the writer of the
device driver should know best what to do when a particular piece of
hardware is having difficulties. Ideally the writer should ensure
that something which is stuck will timeout eventually. But device
drivers are written by lots of different people, probably less unified
in vision or uniform in construction than the rest of an OS, and
therefore something of a weak link.
--
Replace ragwind.localdomain with rahul for a working email address
------------------------------
From: <[EMAIL PROTECTED]>
Subject: Lilo w/ Win98 and RH7, adding Win2k
Date: Fri, 16 Mar 2001 03:30:05 -0000
I have Windows98 and RedHat7 dual booting ok now. I'm going to reinstall
98, and eventually would like to add Win2k.
How do I put lilo back on the MBR after reinstalling 98? Just boot w/ a
linux boot disk and then /sbin/lilo?
>From everything I've read, I guess it would've been better to go 98,Win2k,
then linux, but I didn't have Win2k yet. So, how's this work now? Will
lilo let me pick 98, Win2k, or linux if I edit lilo.conf to add
other = /dev/hdxx
label = win2k ?
Or is it much more complicated, something to do with Win2k's boot loader?
Should lilo boot 98, Win2k, or linux? Or linux or Win2k's boot loader,
then 98 or Win2k? Or is Win2k's boot loader supposed to be first.
Help...
Go easy on this near-newbie, please.
Thanks!
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: [EMAIL PROTECTED] (Dances With Crows)
Subject: Re: "Invalid session number or type of track" error during boot
Date: 16 Mar 2001 04:16:44 GMT
Reply-To: [EMAIL PROTECTED]
On Thu, 15 Mar 2001 17:11:02 +0100, Craig Manley staggered into the
Black Sun and said:
>I've just copied all my partitions to a new bigger harddisk using Ghost.
>I've increased the size of all my partitions. Because Linux was on my
>last partitions after cylinder 1024, I moved the Linux partitions to the
>start of my harddisk with PartitionMagic. After booting the system from
>a floppy and reinstalling Lilo, I can finally boot Linux from the hard
>disk to the point where it stops with the error message "Invalid session
>number or type of track".
Huh? Um, what's the exact text of the error message? What you wrote
sounds like an error that's related to a CD-ROM; hard disks do not have
sessions. At what point in the boot process do you see that message?
(The 4 or 5 lines right before the error message should be sufficient.)
Boot from a bootdisk again and double-check your /etc/lilo.conf, making
sure that root= is right. Oh, if you're using an initial RAM disk...
DON'T! It causes more problems than it solves; just compile {IDE,SCSI}
disk support, SCSI support, support for the SCSI controller you use,
ext2 or ReiserFS filesystem support, and ELF binary suport into the
kernel. Initial RAM disks are useful in certain narrow circumstances,
but that's all they should really be used for.
You didn't really need Ghost to do what you did, either. Check the
Hard-Disk-Upgrade Mini-HOWTO at http://linuxdoc.org/HOWTO/mini/ next
time you need to do something like this.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / Workin' in a code mine, hittin' Ctrl-Alt
http://www.brainbench.com / Workin' in a code mine, whoops!
=============================/ I hit a seg fault....
------------------------------
From: [EMAIL PROTECTED] (Dances With Crows)
Subject: Re: can a serial connection work when keyboard/monitor doesn't?
Date: 16 Mar 2001 04:17:03 GMT
Reply-To: [EMAIL PROTECTED]
On Thu, 15 Mar 2001 19:25:23 GMT, Randy R staggered into the Black Sun
and said:
>We run about 300 - 400 dedicated linux servers, and every night/day 1
>or 2 machines freeze up. All the hardware runs newer motherboards with
>ps2 keyboards and mice.
Are there any common elements among the machines that freeze? (Been up
for X hours, running processes Y and Z, machines A-D tend to die much
more often than any others, motherboards were built by the lowest
bidder, etcetera.)
>I don't know what Alt-SysRq-S, Alt-SysRq-U, Alt-SysRq-B means, please
>explain.
/usr/src/linux/Documentation/sysrq.txt has the scoop. This is a kernel
compilation option which should be on in almost all cases. IIRC RedHat
boxen do some magic with enabling/disabling this functionality upon boot
depending on something in /etc/sysconfig/ . If it's in your kernel, you
can activate it with "echo '1' > /proc/sys/kernel/sysrq" and then
pressing Alt-SysRq-$KEY will make the kernel take certain actions
depending on $KEY. This functionality is very low-level and can do
things even when X/the consoles/the network/large parts of the kernel
have gone bye-bye.
>What you said about hot-plugging a keyboard into the computer is
>exactly what I was wondering, if the computer will not respond to the
>keyboard because the computer is too busy to notice that a keyboard
>was plugged into it. I assume from your response it doesn't matter
>whether the keyboard is plugged into it
What I was referring to is the design problem (since fixed on *most*
PC motherboards) where plugging/unplugging a PS/2 device while the
machine was powered on could hang the system, or in the worst case burn
out components on the board. Also, if a machine has no keyboard
connected at boot time, the kernel may not initialize the keyboard when
it's plugged in for the first time--on x86 hardware at least, the BIOS
is supposed to get the keyboard controller into a sane state before the
kernel even starts up.
>I do intend to experiment with connecting to the compter via a serial
>connection to see if it responds differently.
Hmm. You'd need to have a serial console running or start a getty
process on /dev/ttyS0 *before* the machine locked up for this to work.
I repeat: Have you tried to ssh in over the network?
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / Workin' in a code mine, hittin' Ctrl-Alt
http://www.brainbench.com / Workin' in a code mine, whoops!
=============================/ I hit a seg fault....
------------------------------
From: wmchan <[EMAIL PROTECTED]>
Subject: Re: "telent localhost" failure
Date: Fri, 16 Mar 2001 09:33:24 +0800
man hosts.allow
man hosts.deny
You might wanted to add 127.0.0.1 (localhost) in the access
control lists.
wmchan.
[EMAIL PROTECTED] wrote:
>
> Pai-Yi HSIAO <[EMAIL PROTECTED]> wrote:
> > But how to check telnet server is installed and inetd deamon is running?
>
> If you have installed the telnet server, you should have the
> /usr/sbin/in.telnetd file (or whatever is called in your inetd.conf
> file).
>
> For inetd, ps -ef | grep inetd should do the trick, in my system this
> is what I get:
>
> $ ps -ef | grep inetd
> root 417 1 0 07:49 ? 00:00:00 inetd
> davide 1575 1351 0 14:44 pts/1 00:00:00 grep inetd
>
> The first line is the important one, it shows that inetd is up
> and running.
>
> Davide
------------------------------
From: Hung Ngoc Lai <[EMAIL PROTECTED]>
Subject: help with Linux FreeS/Wan VPN installation
Date: 16 Mar 2001 01:34:27 GMT
hi everyone,
Has anyone had any success with FreeS/Wan for Linux (i.e.
VPN gateway, IPSec tunnel) on Redhat Linux 7.0 with
kernel 2.4.2. I downloaded freeswan-1.8.tar.gz and performed
the following operations:
gunzip freeswan-1.8.tar.gz
tar -xvpf freeswan-1.8.tar
I go to /usr/src/freeswan-1.8 perform this operation:
make ogo
It gives me an error that the kernel can NOT be patched.
I read that at the moment, only RedHat 6.2 with kernel 2.2.17
is supported. Does it mean I have to reinstall my box
from scratch. Anyone know a workaround for this
problem? Please help me...
Thanks.
Hung
[EMAIL PROTECTED]
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list by posting to comp.os.linux.misc.
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Misc Digest
******************************