summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2004-07-23 21:31:57 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-23 21:31:57 (UTC)
commit125671c860a82643d36bc3da279d0b831fae4b34 (patch) (unidiff)
treeab5edcac7c58e769c9d8436ae0e803edb2ebca9f
parent0a7f5999eb47ce113b3cd47b03198947441945a7 (diff)
downloaddudki-125671c860a82643d36bc3da279d0b831fae4b34.zip
dudki-125671c860a82643d36bc3da279d0b831fae4b34.tar.gz
dudki-125671c860a82643d36bc3da279d0b831fae4b34.tar.bz2
ability to send arbitrary signals
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS.xml2
-rw-r--r--man/dudki.8.in11
-rw-r--r--src/dudki.cc20
3 files changed, 29 insertions, 4 deletions
diff --git a/NEWS.xml b/NEWS.xml
index 646bb90..cd12d05 100644
--- a/NEWS.xml
+++ b/NEWS.xml
@@ -3,3 +3,3 @@
3 <version version="0.2" date="July 23rd, 2004"> 3 <version version="0.2" date="July 23rd, 2004">
4 <ni>now dudki sends signals to the processes being monitored from the command line</ni> 4 <ni>now dudki sends arbitrary signals to the processes being monitored from the command line</ni>
5 </version> 5 </version>
diff --git a/man/dudki.8.in b/man/dudki.8.in
index 05db733..be60f53 100644
--- a/man/dudki.8.in
+++ b/man/dudki.8.in
@@ -1,2 +1,2 @@
1.TH dudki 8 "June 9th, 2004" "dudki(8)" "Klever Group (http://www.klever.net/)" 1.TH dudki 8 "July 23rd, 2004" "dudki(8)" "Klever Group (http://www.klever.net/)"
2.hla en 2.hla en
@@ -6,3 +6,3 @@
6 6
7dudki \- a process monitoring daemon 7dudki \- a process maintenance daemon
8 8
@@ -24,2 +24,4 @@ dudki \- a process monitoring daemon
24.if \*[longopt] [\fB--check\fR] 24.if \*[longopt] [\fB--check\fR]
25[\fB-s\fR \fIsignum\fR]
26.if \*[longopt] [\fB--signal=\fR\fIsignum\fR]
25[\fB-e\fR] 27[\fB-e\fR]
@@ -57,2 +59,7 @@ Reload the running instance by sending the \fBSIGHUP\fR signal. Like with
57.TP 59.TP
60.ie \*[longopt] \fB-s\fR \fIsignum\fR, \fB--signal=\fR\fIsignum\fR
61.el \fB-s\fR \fIsignum\fR
62Send arbitrary signal to the names processes (or self, but it doesn't make much
63sense).
64.TP
58.ie \*[longopt] \fB-c\fR, \fB--check\fR 65.ie \*[longopt] \fB-c\fR, \fB--check\fR
diff --git a/src/dudki.cc b/src/dudki.cc
index e91ad5e..9562079 100644
--- a/src/dudki.cc
+++ b/src/dudki.cc
@@ -3,2 +3,3 @@
3#include <syslog.h> 3#include <syslog.h>
4#include <errno.h>
4#include <iostream> 5#include <iostream>
@@ -70,3 +71,3 @@ int main(int argc,char **argv) {
70 while(true) { 71 while(true) {
71 #defineSHORTOPTSTRING "f:hVLrkcet" 72 #defineSHORTOPTSTRING "f:hVLrkcets:"
72#ifdef HAVE_GETOPT_LONG 73#ifdef HAVE_GETOPT_LONG
@@ -80,2 +81,3 @@ int main(int argc,char **argv) {
80 { "reload", no_argument, 0, 'r' }, 81 { "reload", no_argument, 0, 'r' },
82 { "signal", required_argument, 0, 's' },
81 { "check", no_argument, 0, 'c' }, 83 { "check", no_argument, 0, 'c' },
@@ -106,2 +108,4 @@ int main(int argc,char **argv) {
106 " -r, --reload reload running instance (send SIGHUP)\n" 108 " -r, --reload reload running instance (send SIGHUP)\n"
109 " -s signum, --signal=signum\n"
110 " send the specified signal to the running process\n"
107 " -c, --check check if the process is running\n" 111 " -c, --check check if the process is running\n"
@@ -119,2 +123,3 @@ int main(int argc,char **argv) {
119 " -r reload running instance (send SIGHUP)\n" 123 " -r reload running instance (send SIGHUP)\n"
124 " -s signum send the specified signal to the running process\n"
120 " -c check if the process is running\n" 125 " -c check if the process is running\n"
@@ -175,2 +180,15 @@ int main(int argc,char **argv) {
175 break; 180 break;
181 case 's':
182 if(op!=op_default) {
183 cerr << "Can't obey two or more orders at once" << endl;
184 exit(1);
185 }
186 op = op_signal;
187 errno = 0;
188 op_signum = strtol(optarg,NULL,0);
189 if(errno) {
190 cerr << "Can't obtain the signal value" << endl;
191 exit(1);
192 }
193 break;
176 default: 194 default: