SSD_NICELEVEL can now affect the nicelevel for daemons started

by start-stop-daemon, #175397.
This commit is contained in:
Roy Marples 2007-05-02 12:33:56 +00:00
parent d599a40680
commit c3608471cd
5 changed files with 21 additions and 19 deletions

View File

@ -3,6 +3,9 @@
02 May 2007; Roy Marples <uberlord@gentoo.org>: 02 May 2007; Roy Marples <uberlord@gentoo.org>:
SSD_NICELEVEL can now affect the nicelevel for daemons started
by start-stop-daemon, #175397.
Don't delete addresses for PPP interfaces, #176764. Don't delete addresses for PPP interfaces, #176764.
30 Apr 2007; Roy Marples <uberlord@gentoo.org>: 30 Apr 2007; Roy Marples <uberlord@gentoo.org>:

View File

@ -74,15 +74,8 @@ RC_FORCE_AUTO="no"
# really want them to work on a global basis. # really want them to work on a global basis.
# Some daemons are started and stopped via start-stop-daemon. # Some daemons are started and stopped via start-stop-daemon.
# We can launch them through other daemons here, for example valgrind. # We can set some things on a per service basis, like the nicelevel.
# This is only useful for serious debugging of the daemon #export SSD_NICELEVEL="-19"
# WARNING: If the script's "stop" function does not supply a PID file then
# all processes using the same daemon will be killed.
#RC_DAEMON="/usr/bin/valgrind --tool=memcheck --log-file=/tmp/valgrind.syslog-ng"
# strace needs to be prefixed with --background as it does not detach when
# it's following
#RC_DAEMON="--background /usr/sbin/strace -f -o /tmp/strace.syslog-ng"
# Pass ulimit parameters # Pass ulimit parameters
#RC_ULIMIT="-u 30" #RC_ULIMIT="-u 30"
@ -91,3 +84,4 @@ RC_FORCE_AUTO="no"
#RC_NEED="openvpn" #RC_NEED="openvpn"
#RC_USE="net.eth0" #RC_USE="net.eth0"

View File

@ -200,16 +200,17 @@ will force
to fork before starting the process, and force it into the background. to fork before starting the process, and force it into the background.
.TP .TP
\fB-1\fP|\fB--stdout\fP \fIlogfile\fP \fB-1\fP|\fB--stdout\fP \fIlogfile\fP
Redirect the standard output of the process to \fIlogfile\fP when started with \fB--background\fP. Redirect the standard output of the process to \fIlogfile\fP when started with
Must be an absolute pathname, but relative to the \fIpath\fP optionally given with \fB--background\fP. Must be an absolute pathname, but relative to the
\fB--chroot\fP. \fIpath\fP optionally given with \fB--chroot\fP.
Hint: The \fIlogfile\fP can also be a named pipe. Hint: The \fIlogfile\fP can also be a named pipe.
.TP .TP
\fB-2\fP|\fB--stderr\fP \fIlogfile\fP \fB-2\fP|\fB--stderr\fP \fIlogfile\fP
The same thing as \fB--stdout\fP but with the standard error output. The same thing as \fB--stdout\fP but with the standard error output.
.TP .TP
.BR -N | --nicelevel .BR -N | --nicelevel
This alters the prority of the process before starting it. This alters the prority of the process before starting it. This can also be set
by the environment variable \fBSSD_NICELEVEL\fR.
.TP .TP
.BR -m | --make-pidfile .BR -m | --make-pidfile
Used when starting a program that does not create its own pid file. This Used when starting a program that does not create its own pid file. This

View File

@ -6,14 +6,14 @@
#include "librc.h" #include "librc.h"
#define ERRX eerrorx("out of memory"); #define ERRX eerrorx("out of memory");
#define PROFILE_ENV "/etc/profile.env" #define PROFILE_ENV "/etc/profile.env"
#define SYS_WHITELIST RC_LIBDIR "conf.d/env_whitelist" #define SYS_WHITELIST RC_LIBDIR "conf.d/env_whitelist"
#define USR_WHITELIST "/etc/conf.d/env_whitelist" #define USR_WHITELIST "/etc/conf.d/env_whitelist"
#define RC_CONFIG "/etc/conf.d/rc" #define RC_CONFIG "/etc/conf.d/rc"
#define PATH_PREFIX RC_LIBDIR "bin:/bin:/sbin:/usr/bin:/usr/sbin" #define PATH_PREFIX RC_LIBDIR "bin:/bin:/sbin:/usr/bin:/usr/sbin"
#ifndef S_IXUGO #ifndef S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)

View File

@ -537,6 +537,10 @@ int main (int argc, char **argv)
signal (SIGQUIT, handle_signal); signal (SIGQUIT, handle_signal);
signal (SIGTERM, handle_signal); signal (SIGTERM, handle_signal);
if ((env = getenv ("SSD_NICELEVEL")))
if (sscanf (env, "%d", &nicelevel) != 1)
eerror ("%s: invalid nice level `%s' (SSD_NICELEVEL)", progname, env);
while ((c = getopt_long (argc, argv, while ((c = getopt_long (argc, argv,
"KN:R:Sbc:d:g:mn:op:qs:tu:r:vx:1:2:", "KN:R:Sbc:d:g:mn:op:qs:tu:r:vx:1:2:",
longopts, (int *) 0)) != -1) longopts, (int *) 0)) != -1)