commit 4033936829767421a2c9f6414c710e6270a91cca
parent fcd80f81722a4b7f735c2a8ee66b245896dbcacb
Author: sanjiyan <sanjiyan>
Date: Fri, 17 Feb 2006 07:42:11 +0000
add a few small features like:
- changing the nice
- redirecting the output without extra log process
Diffstat:
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -46,6 +46,21 @@ Each service directory can contain the following files/symlinks:
process dies and is restarted, no log entries will be lost and there
will be no SIGPIPE.
+ nice
+
+ a plain text file containing the value to add to the nice level via the
+ nice systemcall.
+
+ in
+
+ this file is used for stdin.
+
+ out
+
+ this file is used for stdout and stderr.
+ e.g. a symlink to /dev/null
+
+
Please see http://cr.yp.to/daemontools/multilog.html for a very good
logging tool.
diff --git a/minit.c b/minit.c
@@ -237,6 +237,21 @@ again:
req.tv_nsec=500000000;
nanosleep(&req,0);
}
+ if ((fd=open("in",O_RDONLY))!=-1) {
+ dup2(fd,0);
+ fcntl(0,F_SETFD,0);
+ }
+ if ((fd=open("out",O_WRONLY))!=-1) {
+ dup2(fd,1);
+ dup2(fd,2);
+ fcntl(1,F_SETFD,0);
+ fcntl(2,F_SETFD,0);
+ }
+ if (!openreadclose("nice",&s,&len)) {
+ int n=atoi(s);
+ nice(n);
+ s=0;
+ }
if (!openreadclose("params",&s,&len)) {
argv=split(s,'\n',&argc,2,1);
if (argv[argc-1]) argv[argc-1]=0; else argv[argc]=0;