[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5080: mysql_connect(): Too many connections
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5106: mysql_query(): Too many connections
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5106: mysql_query(): A link to the server could not be established
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5107: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
CAA: Christian Anime Alliance • Quick Unix Question
Page 1 of 1

Quick Unix Question

PostPosted: Thu Feb 23, 2006 1:02 am
by Slater
I heard today from my professor about a student who got in trouble for running the command "find \ -mdate +0" on libra (campus server for students to work on, holding tens of thousands of accounts). They say that the computer processed it for weeks before the system admins found it and made it stop. I'm just wondering... cause I can see myself doing something stupid like that in the future, how do you terminate such a process once it gets going?

PostPosted: Thu Feb 23, 2006 4:26 am
by blkmage
"killall" or "kill".
"killall" for killing the process by name.
"kill" for killing the process by process ID.
You can find the processes by using "ps aux".

PostPosted: Thu Feb 23, 2006 6:29 am
by shooraijin
... or ps -ef on older, stupider -- er, non-BSD-aware ;) -- systems (not sure which Unix this is).

btw, he probably meant 'find / ...' since most Unices don't use \ as a path delimiter.

PostPosted: Thu Feb 23, 2006 9:41 am
by Slater
I always get forward and backwards slashes mixed, heh.

Thanx for the commands!

PostPosted: Thu Feb 23, 2006 8:31 pm
by Mithrandir
Yup. "ps -ax | grep find" will tell you what the ID of the process ID is, and you can use kill on that ID. If you have a newer system, you can probably use "killall -TERM find" and get your process killed off quickly. That's more a linux style than, say, HPUX.

PostPosted: Fri Mar 10, 2006 12:33 pm
by Slater
uhm... I just typed in 'fgrep "new"' and ran it and apparently this started a search through /. I tried all of the above things to try to kill it and the OS tells me that I don't have security clearance to run those commands (since I am logged in remotely). Any other suggestions before the campus police come knocking on my door?

PostPosted: Fri Mar 10, 2006 1:05 pm
by Kaligraphic
Perhaps you could call whoever's in charge of the server, and ask their help. Calling in after a process has been running for, say, an hour, and identifying what needs to be killed is nowhere near as bad as just letting a job run and tie things up for the admins to find later while investigating user complaints.

PostPosted: Fri Mar 10, 2006 5:55 pm
by shooraijin
Slater wrote:uhm... I just typed in 'fgrep "new"' and ran it and apparently this started a search through /. I tried all of the above things to try to kill it and the OS tells me that I don't have security clearance to run those commands (since I am logged in remotely). Any other suggestions before the campus police come knocking on my door?


I don't follow. How would

fgrep "new"

go through /? You haven't specified anything to search. It'll just sit there and expect data on standard input.

PostPosted: Fri Mar 10, 2006 11:41 pm
by Mithrandir
Well, if you have a process that's going nuts, I'd use ctrl-c to cancel it. You'll have to wait for the video buffer to catch up to the actual program, though, which took some time on some old dumb terminals, as I recall.

Shooby's right, though. I don't think that program would do anything at all (as far as I can tell) if you ran it that way. Maybe with an asterisk after it you'd get those errors... If you did it like this:

cd /
fgrep "new" *

That would do it.

PostPosted: Sat Mar 11, 2006 12:57 am
by Slater
yeah, I did a ctrl-d and it died. I need to study my unix a little more before running arbitrary commands...

PostPosted: Sat Mar 11, 2006 10:31 pm
by Kaligraphic
Note to self: read post thoroughly before responding. :)

When I started learning the Unixey way of doing things, I used to pull up the manpage of every command I'd run - yes, even grep.

PostPosted: Sat Mar 11, 2006 10:33 pm
by Slater
I don't like man. I don't like reading 500 pages of stuff for every command x.x

PostPosted: Sat Mar 11, 2006 10:58 pm
by LorentzForce
Well, you'll have to get used to it. There's no way around it.

PostPosted: Sun Mar 12, 2006 7:42 am
by Mithrandir
LF is right. If you want to learn how things work, man is the way to go. Try using it on a command you are fairly fluent in and see how much more the command can do you never knew about.

PostPosted: Sun Mar 12, 2006 10:25 am
by Slater
hmm... well, my professor said that it would either be using man or getting the book "Unix in a Nutshell," which is like a dictionary of every command in unix. Perhaps the book isn't such a bad idea...

PostPosted: Sun Mar 12, 2006 2:16 pm
by Kaligraphic
I think you may find man more to your liking when you start seeing the cool things that you can do. I learned so much just by typing man bash that it's not even funny.

But most commands only have a couple of pages, really. bash has a long manpage because it teaches you how to use the shell - all the little tricks, so to speak.

PostPosted: Sun Mar 12, 2006 3:49 pm
by Mithrandir
There are, however, somethings man can't tell you:


Code: Select all
lum:~ mithrandir$ man "getting girls to like you."
No manual entry for getting girls to like you.


Of course, the computer's power is limited:

Code: Select all
lum:~ mithrandir$ find "my purpose in life"
find: my purpose in life: No such file or directory



(Note: these are the actual responses from the programs.)

PostPosted: Sun Mar 12, 2006 6:40 pm
by shooraijin
I always liked

% ping elvis
elvis is alive

but that doesn't work on many systems anymore.

Oh, and

% how is my studliness'
Unmatched '.

PostPosted: Sun Mar 12, 2006 6:41 pm
by shooraijin
Also, what is it with you people and shells? tcsh is God's Chosen Shell. It is Salvation.