Fix the NOHUP_NICENESS test in mysqld_safe.
scripts/mysqld_safe.sh: Fix the NOHUP_NICENESS test; previously it would break if the process already had a negative priority.
This commit is contained in:
parent
8a015dc327
commit
47d42a13f6
@ -159,15 +159,48 @@ export MYSQL_TCP_PORT
|
|||||||
|
|
||||||
|
|
||||||
NOHUP_NICENESS="nohup"
|
NOHUP_NICENESS="nohup"
|
||||||
if test -w /
|
|
||||||
|
# Using nice with no args to get the niceness level is GNU-specific.
|
||||||
|
# This check could be extended for other operating systems (e.g.,
|
||||||
|
# BSD could use "nohup sh -c 'ps -o nice -p $$' | tail -1").
|
||||||
|
# But, it also seems that GNU nohup is the only one which messes
|
||||||
|
# with the priority, so this is okay.
|
||||||
|
if nohup nice > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
NOHUP_NICENESS=`nohup nice 2>&1`
|
normal_niceness=`nice`
|
||||||
if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1
|
nohup_niceness=`nohup nice`
|
||||||
then
|
|
||||||
NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
|
numeric_nice_values=1
|
||||||
else
|
for val in $normal_niceness $nohup_niceness
|
||||||
NOHUP_NICENESS="nohup"
|
do
|
||||||
fi
|
case "$val" in
|
||||||
|
-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | \
|
||||||
|
[0-9] | [0-9][0-9] | [0-9][0-9][0-9] )
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
numeric_nice_values=0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if test $numeric_nice_values -eq 1
|
||||||
|
then
|
||||||
|
nice_value_diff=`expr $nohup_niceness - $normal_niceness`
|
||||||
|
if test $? -eq 0 && test $nice_value_diff -gt 0 && \
|
||||||
|
nice --$nice_value_diff echo testing > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
# nohup increases the priority (bad), and we are permitted
|
||||||
|
# to lower the priority
|
||||||
|
NOHUP_NICENESS="nice --$nice_value_diff nohup"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if nohup echo testing > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
# nohup doesn't work on this system
|
||||||
|
NOHUP_NICENESS=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
USER_OPTION=""
|
USER_OPTION=""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user