FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 04-23-2012, 01:30 PM
Gaetan Bisson
 
Default renice Bash at login

[2012-04-23 14:25:09 +0100] Leonidas Spyropoulos:
> Well I want to decrease the priority of all users logged into the
> system (expect root) at login. So let's say run every bash and every
> spawned process that a user run with priority 5.

I understand but why do that when you can just increase the scheduling
priority of your beloved root processes instead?

--
Gaetan
 
Old 04-23-2012, 01:48 PM
Geert Hendrickx
 
Default renice Bash at login

On Mon, Apr 23, 2012 at 14:25:09 +0100, Leonidas Spyropoulos wrote:
> Well I want to decrease the priority of all users logged into the
> system (expect root) at login. So let's say run every bash and every
> spawned process that a user run with priority 5.



If your users are just running vi and grep and the like, and not any
long-running, CPU intensitive tasks, this will make zero difference in
overall performance of your server.


Geert


--
geert.hendrickx.be :: geert@hendrickx.be :: PGP: 0xC4BB9E9F
This e-mail was composed using 100% recycled spam messages!
 
Old 04-23-2012, 01:52 PM
Leonidas Spyropoulos
 
Default renice Bash at login

On Mon, Apr 23, 2012 at 2:30 PM, Gaetan Bisson <bisson@archlinux.org> wrote:
> [2012-04-23 14:25:09 +0100] Leonidas Spyropoulos:
>> Well I want to decrease the priority of all users logged into the
>> system (expect root) at login. So let's say run every bash and every
>> spawned process that a user run with priority 5.
>
> I understand but why do that when you can just increase the scheduling
> priority of your beloved root processes instead?
True effectively it's the same, but still I would like to not be
forced to run nice for every command the root run.
>
> --
> Gaetan

--
Caution: breathing may be hazardous to your health.

#include <stdio.h>
int main(){printf("%s","x4cx65x6fx6ex69x64x61x73");}
 
Old 04-23-2012, 02:01 PM
Gaetan Bisson
 
Default renice Bash at login

[2012-04-23 14:52:56 +0100] Leonidas Spyropoulos:
> True effectively it's the same, but still I would like to not be
> forced to run nice for every command the root run.

You don't need to do that for *every* command, just those that are super
important to you. Anything else sounds like bad practice to me.

But see `man limits.conf` if you really want to...

--
Gaetan
 
Old 04-23-2012, 03:17 PM
Mauro Santos
 
Default renice Bash at login

On 23-04-2012 14:48, Geert Hendrickx wrote:
> On Mon, Apr 23, 2012 at 14:25:09 +0100, Leonidas Spyropoulos wrote:
>> Well I want to decrease the priority of all users logged into the
>> system (expect root) at login. So let's say run every bash and every
>> spawned process that a user run with priority 5.
>
>
>
> If your users are just running vi and grep and the like, and not any
> long-running, CPU intensitive tasks, this will make zero difference in
> overall performance of your server.
>
>
> Geert
>
>

I've dealt with CPU hogging processes with a cron job. It runs every
hour and does the following _only_ for user accounts (it doesn't touch
root or system/daemons accounts):
for every process check if it has used more than 30min of cpu time,
if yes then check niceness, if niceness is lower than 15, raise niceness
to 15, otherwise do nothing.

Normal processes should not be affected, short spikes of cpu usage are
allowed but cpu hogging processes will get niced not to slow the whole
system to a halt. The idea is to interfere as little as possible with
the running processes.

--
Mauro Santos
 
Old 04-23-2012, 06:03 PM
Leonidas Spyropoulos
 
Default renice Bash at login

On Monday, April 23, 2012, Mauro Santos <registo.mailling@gmail.com> wrote:
> On 23-04-2012 14:48, Geert Hendrickx wrote:
>> On Mon, Apr 23, 2012 at 14:25:09 +0100, Leonidas Spyropoulos wrote:
>>> Well I want to decrease the priority of all users logged into the
>>> system (expect root) at login. So let's say run every bash and every
>>> spawned process that a user run with priority 5.
>>
>>
>>
>> If your users are just running vi and grep and the like, and not any
>> long-running, CPU intensitive tasks, this will make zero difference in
>> overall performance of your server.
>>
>>
>> Geert
>>
>>
>
> I've dealt with CPU hogging processes with a cron job. It runs every
> hour and does the following _only_ for user accounts (it doesn't touch
> root or system/daemons accounts):
> for every process check if it has used more than 30min of cpu time,
> if yes then check niceness, if niceness is lower than 15, raise niceness
> to 15, otherwise do nothing.
>
> Normal processes should not be affected, short spikes of cpu usage are
> allowed but cpu hogging processes will get niced not to slow the whole
> system to a halt. The idea is to interfere as little as possible with
> the running processes.
Can you share the script please?

>
> --
> Mauro Santos
>

--
Caution: breathing may be hazardous to your health.

#include <stdio.h>
int main(){printf("%s","x4cx65x6fx6ex69x64x61x73");}
 
Old 04-23-2012, 06:27 PM
Mauro Santos
 
Default renice Bash at login

On 23-04-2012 19:03, Leonidas Spyropoulos wrote:
> Can you share the script please?
>
>>
>> --
>> Mauro Santos
>>
>

For arch it would be something like this:

#!/bin/bash
renice 15 `ps axo "bsdtime,euid,pid,nice,%cpu,comm" | sed 's/:..//' |
awk '{if ($2 >= 1000 && $1 > 30 && $5 > 80 && $4 < 15 ) print $3}'`

The script should be only two lines long (the shebang + command).
Name it whatever you like, put it inside /etc/cron.hourly and make sure
it is executable.
I guess it's not pretty but gets the job done

--
Mauro Santos
 
Old 04-23-2012, 07:27 PM
Leonidas Spyropoulos
 
Default renice Bash at login

On Mon, Apr 23, 2012 at 7:27 PM, Mauro Santos
<registo.mailling@gmail.com> wrote:
> On 23-04-2012 19:03, Leonidas Spyropoulos wrote:
>> Can you share the script please?
>>
>>>
>>> --
>>> Mauro Santos
>>>
>>
>
> For arch it would be something like this:
>
> #!/bin/bash
> renice 15 `ps axo "bsdtime,euid,pid,nice,%cpu,comm" | sed 's/:..//' |
> awk '{if ($2 >= 1000 && $1 > 30 && $5 > 80 && $4 < 15 ) print $3}'`
>
> The script should be only two lines long (the shebang + command).
> Name it whatever you like, put it inside /etc/cron.hourly and make sure
> it is executable.
> I guess it's not pretty but gets the job done

Thanks that will do probably.

>
> --
> Mauro Santos


--
Caution: breathing may be hazardous to your health.

#include <stdio.h>
int main(){printf("%s","x4cx65x6fx6ex69x64x61x73");}
 
Old 04-24-2012, 02:20 AM
XeCycle
 
Default renice Bash at login

Leonidas Spyropoulos <artafinde@gmail.com> writes:

> Hi all,
>
> I searched around with no help so if you can help out:
>
> I am trying to renice the user bash on Login. So every time someone
> logs through SSH to the server to get a lower priority than normal.
> Is that possible?

Of course, the simplest being `exec nice 10 bash' in your
.bash_profile. renice is not always needed.

> Is it a good idea in general? A server usually is not to be
> used from users, only login sporadic to do updates and various
> maintenance work
>
> Thanks
> Leonidas

--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
 

Thread Tools




All times are GMT. The time now is 11:26 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org