I Think I Totally Screwed Up

software development

#1

I’ve been trying to improve my console skills, and have been pushing myself to learn as much as possible. I think I made a big mistake this time though.

I decided to “go for it” on a custom installation of php5, to see if I could pull it off. I created a new user, then created a new subdomain owned by that user so I wouldn’t mess up anything existing.

I have read this wiki article a few times: http://wiki.dreamhost.com/index.php/Installing_PHP5, and got started. I don’t think the process is failing or anything so far, but it dawned on me that I didn’t think to, or know exactly where to, put “nice” commands. So now, I’m the dude bogging down the box for everyone else as this stupid script continues to run.

I promise I would never intentionally do something to negatively impact DH, but wasn’t sweating it since so many people have posted “here’s the link to a custom PHP5 install script”. Maybe these commands are designed to be courteous to other processes.

If not maybe the wiki article should be updated just to serve as a warning to people like me… As I was typing this, I see that the script was mercifully killed. Should I contact someone to let them know I made a mistake in attempting this, so they know I meant no harm?

Thanks for any feedback and understanding. If there are any pointers or advice on cleaning up so as to have the least impact, I look forward to them. Thanks.

http://benconley.net
http://teamshocker.com


#2

Heh! “Stuff” happens! I wouldn’t worry too much about it; that’s why DH 's procwatch kills stuff - so you don’t bork everyone else :wink: .

You are not alone on having that PHP5 script killed - there is an earlier thread on this forum where some poor guy fought with that for quite a bit.

Have you checked out the man page for nice?

–rlparker


#3

Yes, I did check out man nice when setting up my awstats install. Then used it in my cron job

1 3 * * * nice -20 /usr/local/bin/perl /home... I never ran any script as big as the PHP5 install script though. Since it’s filled with successive commands, I am under the impression that I’d want to add “nice” to every “make” and “tar” command. There isn’t a way to make an entire script run as nice is there?

http://benconley.net
http://teamshocker.com


#4

My impression is the same as yours, though I don’t know that every “make” and “tar” would need to be niced. I would probably try to just use it on the parts of the script that seem to take a long time.

That’s a good question, and I really don’t know the answer; maybe some *nix wizard out there can educate us both on that point :slight_smile:

–rlparker


#5

In reply to:

There isn’t a way to make an entire script run as nice is there?

Pardon me – all these years and I still dunno how to quote properly! Good question here, I’d always assumed that child processes would inherit the nice priority of the parent. And then I realized that this has been an assumption on my part… So I went and found at least one source that affirms that thinking. I’m not a *nix wizard though and my search was too brief to pretend it should serve as conclusive evidence.

http://www.linux-tutorial.info/modules.php?name=Tutorial&pageid=85
"The nice value only affects running processes, but child processes inherit the nice value of their parent. By default, processes that users start have a nice value of 20."

So I really don’t think you have to sweat adding nice to all the scripts system commands. But I’m curious to hear from an expert myself!


jt


#6

Get the process ID of your currently running shell by running a “ps” command like so:

$ ps PID TTY TIME CMD 14609 pts/2 00:00:00 bash 127 pts/2 00:00:00 ps $…this shows my currently running shell to be process ID 14609. Once I have this number then I can run a “renice” command on my shell:

$ renice +19 14609 14609: old priority 0, new priority 19 $For the duration of that shell session all spawned child procs should retain correct niceness. Note that positive numbers lower the priority (which makes the procs “nicer”).