Hello,
I had you followed a bug reported by a Ubuntu user [1] about nice value
change:
According to man nice and info coreutils nice, it is
not possible for a non-root user to decrease the niceness
of a process (even if they were the ones that increased the
niceness). However this not the case in Ubuntu 9.04, as
evidenced by the fact that the attached script stopfirefox
can reduce the niceness back to 0 when firefox is unminimized.
The manpage and infopage should be modified in light of this,
and should also say where this was configured.
According to
http://en.wikipedia.org/wiki/Nice_%28Unix%29#cite_note-0 This
can be configured in /etc/security/limits.conf, however this
does not seem to have any uncommented lines, so presumably
Ubuntu configured this somewhere else.
ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 9.04
NonfreeKernelModules: fglrx
PackageArchitecture: all
ProcEnviron:
SHELL=/bin/bash
PATH=(custom, user)
LANG=en_AU.UTF-8
Uname: Linux 2.6.28-14-generic x86_64
I think that add a reference to talk about /etc/security/limits.conf is
a good idea.
[1] https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/468518
Regards,
--
Stéphane Aulery
#!/bin/sh
#
# A simple shell script to stop Firefox using CPU and paging in RAM
#
# John C. McCabe-Dansted, 2009
# Permission is given to use this file under any version of the GPL or LGPL.
#
# Bugs: 1) Only checks if one Firefox window is minimised, others may be
# unminimized, but this will still leave Firefox halted and unresponsive
# until the window this is actually checking is unminimized
#
# 2) Do not minimize Firefox while downloading, or the download will
# time out.
#
# 3) This script itself will use a tiny bit of CPU and RAM while polling
# xwininfo to determine whether Firefox is minimised. You may want to tune
# DELAY. Note that Firefox will be unresponsive for up to DELAY seconds
# after being unminimised.
DELAY=1 # in seconds
main () {
WinID=$1
PID=$3
echo WinID: $WinID
echo PID: $PID
set_running () {
if [ $active = yes ]
then
kill -s CONT $PID
else
kill -s STOP $PID
fi
}
set_nice () {
if [ $active = yes ]
then
renice +0 $PID
else
renice +19 $PID
fi
}
kill -s CONT $PID
running=yes
while true
do
if xwininfo -id $WinID | grep 'Map State: IsUnMapped' /dev/null
then
#Minimized
active=no
else
active=yes
fi
if [ $active = no ]
then
sleep 0.1
kill -s STOP $PID
sleep 0.5
if ! kill -s CONT $PID
then
exit
fi
else
sleep $DELAY
fi
#echo $active
if [ ! $running = $active ]
then
set_nice
running=$active
fi
done
}
main `wmctrl -l -p | grep - Mozilla Firefox$`