aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 10:58:12 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 10:58:12 +0000
commitf223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (patch)
treedc309c15cc447cd3d815d18e44fefb4534e6316b
parent9a3b7b1db736c572ec8c2959daac148369a14cef (diff)
downloadbusybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.tar.gz
busybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.tar.bz2
busybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.zip
svlogd: fix timestamping; do not warn if config is missing
sv: extend help text
-rw-r--r--include/usage.h14
-rw-r--r--runit/sv.c6
-rw-r--r--runit/svlogd.c23
3 files changed, 25 insertions, 18 deletions
diff --git a/include/usage.h b/include/usage.h
index d4d923beb..9c14f4508 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -3256,8 +3256,18 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when
3256#define sv_trivial_usage \ 3256#define sv_trivial_usage \
3257 "[-v] [-w sec] command service..." 3257 "[-v] [-w sec] command service..."
3258#define sv_full_usage \ 3258#define sv_full_usage \
3259 "Report the current status and control the state of services " \ 3259 "Control services monitored by runsv supervisor.\n" \
3260 "monitored by the runsv supervisor" 3260 "Commands (only first character is enough):\n" \
3261 "\n" \
3262 "status: query service status\n" \
3263 "up: if service isn't running, start it. If service stops, restart it\n" \
3264 "once: like 'up', but if service stops, don't restart it\n" \
3265 "down: send TERM and CONT signals. If ./run exits, start ./finish\n" \
3266 " if it exists. After it stops, do not restart service\n" \
3267 "exit: send TERM and CONT signals to service and log service. If they exit,\n" \
3268 " runsv exits too\n" \
3269 "pause, cont, hup, alarm, interrupt, quit, 1, 2, term, kill: send\n" \
3270 "STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, KILL signal to service"
3261 3271
3262#define svlogd_trivial_usage \ 3272#define svlogd_trivial_usage \
3263 "[-ttv] [-r c] [-R abc] [-l len] [-b buflen] dir..." 3273 "[-ttv] [-r c] [-R abc] [-l len] [-b buflen] dir..."
diff --git a/runit/sv.c b/runit/sv.c
index a918bb7bd..9181fff75 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -36,7 +36,7 @@ The sv program reports the current status and controls the state of services
36monitored by the runsv(8) supervisor. 36monitored by the runsv(8) supervisor.
37 37
38services consists of one or more arguments, each argument naming a directory 38services consists of one or more arguments, each argument naming a directory
39service used by runsv(8). If service doesn?t start with a dot or slash, 39service used by runsv(8). If service doesn't start with a dot or slash,
40it is searched in the default services directory /var/service/, otherwise 40it is searched in the default services directory /var/service/, otherwise
41relative to the current directory. 41relative to the current directory.
42 42
@@ -72,6 +72,8 @@ exit
72 72
73sv actually looks only at the first character of above commands. 73sv actually looks only at the first character of above commands.
74 74
75Commands compatible to LSB init script actions:
76
75status 77status
76 Same as status. 78 Same as status.
77start 79start
@@ -104,7 +106,7 @@ force-restart
104 7 seconds for the service to restart. Then report the status, and 106 7 seconds for the service to restart. Then report the status, and
105 on timeout send the service the kill command. If the script ./check 107 on timeout send the service the kill command. If the script ./check
106 exists in the service directory, sv runs this script to check whether 108 exists in the service directory, sv runs this script to check whether
107 the service is up and available again; it?s considered to be available 109 the service is up and available again; it's considered to be available
108 if ./check exits with 0. 110 if ./check exits with 0.
109force-shutdown 111force-shutdown
110 Same as exit, but wait up to 7 seconds for the runsv(8) process to 112 Same as exit, but wait up to 7 seconds for the runsv(8) process to
diff --git a/runit/svlogd.c b/runit/svlogd.c
index b271b743f..e16043e44 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -465,8 +465,8 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
465 465
466 /* read config */ 466 /* read config */
467 i = open_read_close("config", buf, sizeof(buf)); 467 i = open_read_close("config", buf, sizeof(buf));
468 if (i < 0) 468 if (i < 0 && errno != ENOENT)
469 warn2("cannot read config", ld->name); 469 bb_perror_msg(WARNING": %s/config", ld->name);
470 if (i > 0) { 470 if (i > 0) {
471 if (verbose) bb_error_msg(INFO"read: %s/config", ld->name); 471 if (verbose) bb_error_msg(INFO"read: %s/config", ld->name);
472 s = buf; 472 s = buf;
@@ -835,19 +835,8 @@ int svlogd_main(int argc, char **argv)
835 char ch; 835 char ch;
836 836
837 lineptr = line; 837 lineptr = line;
838 taia_now(&now); 838 if (timestamp)
839 /* Prepare timestamp if needed */
840 if (timestamp) {
841 switch (timestamp) {
842 case 1:
843 fmt_taia25(stamp, &now);
844 break;
845 default: /* case 2: */
846 fmt_ptime30nul(stamp, &now);
847 break;
848 }
849 lineptr += 26; 839 lineptr += 26;
850 }
851 840
852 /* lineptr[0..linemax-1] - buffer for stdin */ 841 /* lineptr[0..linemax-1] - buffer for stdin */
853 /* (possibly has some unprocessed data from prev loop) */ 842 /* (possibly has some unprocessed data from prev loop) */
@@ -857,6 +846,7 @@ int svlogd_main(int argc, char **argv)
857 if (!np && !exitasap) { 846 if (!np && !exitasap) {
858 i = linemax - stdin_cnt; /* avail. bytes at tail */ 847 i = linemax - stdin_cnt; /* avail. bytes at tail */
859 if (i >= 128) { 848 if (i >= 128) {
849 taia_now(&now);
860 i = buffer_pread(0, lineptr + stdin_cnt, i, &now); 850 i = buffer_pread(0, lineptr + stdin_cnt, i, &now);
861 if (i <= 0) /* EOF or error on stdin */ 851 if (i <= 0) /* EOF or error on stdin */
862 exitasap = 1; 852 exitasap = 1;
@@ -889,6 +879,11 @@ int svlogd_main(int argc, char **argv)
889 printlen = linelen; 879 printlen = linelen;
890 printptr = lineptr; 880 printptr = lineptr;
891 if (timestamp) { 881 if (timestamp) {
882 taia_now(&now);
883 if (timestamp == 1)
884 fmt_taia25(stamp, &now);
885 else /* 2: */
886 fmt_ptime30nul(stamp, &now);
892 printlen += 26; 887 printlen += 26;
893 printptr -= 26; 888 printptr -= 26;
894 memcpy(printptr, stamp, 25); 889 memcpy(printptr, stamp, 25);