projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CentOS 5 RPM: init, logrotate works
[metaproxy-moved-to-github.git]
/
src
/
metaproxy_prog.cpp
diff --git
a/src/metaproxy_prog.cpp
b/src/metaproxy_prog.cpp
index
11b04b2
..
b598a81
100644
(file)
--- a/
src/metaproxy_prog.cpp
+++ b/
src/metaproxy_prog.cpp
@@
-46,22
+46,31
@@
namespace mp = metaproxy_1;
mp::RouterFleXML *routerp = 0;
mp::RouterFleXML *routerp = 0;
+#if HAVE_UNISTD_H
+static pid_t process_group = 0;
+
static void sig_term_handler(int s)
{
static void sig_term_handler(int s)
{
- if (routerp)
- {
- delete routerp;
- }
- exit(0);
+ kill(-process_group, SIGTERM); /* kill all children processes as well */
+ _exit(0);
}
}
+#endif
static void handler(void *data)
{
routerp = (mp::RouterFleXML*) data;
static void handler(void *data)
{
routerp = (mp::RouterFleXML*) data;
+
+#if HAVE_UNISTD_H
+ /* make the current working process group leader */
+ setpgid(0, 0);
+ process_group = getpgid(0); // save process group ID
signal(SIGTERM, sig_term_handler);
signal(SIGTERM, sig_term_handler);
+#endif
+ routerp->start();
+
mp::Package pack;
mp::Package pack;
- pack.router(*routerp).move();
+ pack.router(*routerp).move(); /* should never exit */
}
static int sc_main(
}
static int sc_main(
@@
-116,7
+125,11
@@
static int sc_main(
uid = arg;
break;
case 'V':
uid = arg;
break;
case 'V':
- std::cout << VERSION "\n";
+ std::cout << VERSION;
+#ifdef VERSION_SHA1
+ std::cout << " " VERSION_SHA1;
+#endif
+ std::cout << "\n";
return 0;
break;
case 'w':
return 0;
break;
case 'w':
@@
-145,7
+158,12
@@
static int sc_main(
return 1;
}
return 1;
}
- yaz_log(YLOG_LOG, "Metaproxy " VERSION " started");
+ yaz_log(YLOG_LOG, "Metaproxy start " VERSION
+#ifdef VERSION_SHA1
+ " " VERSION_SHA1
+#endif
+ );
+
xmlDocPtr doc = xmlReadFile(fname,
NULL,
XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS
xmlDocPtr doc = xmlReadFile(fname,
NULL,
XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS