Bug#387101: restartd: The '-f' (run in foreground) option disappeared

2006-09-12 Thread frealek
Package: restartd
Version: 0.2
Severity: important

Restard version 0.1.a-4 has a '-f' (run in foreground) option.
It is really important to be able to run restartd in foreground.
INIT is usually used to monitor process execution repawning the
process when it stopped. INIT attaches itself to the child
(monitored) process' stdin/out so that it knows when it stopped.
The lack of '-f' option forbids restartd monitoring, which is 
an important point of failure.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-aurora
Locale: LANG=fr_FR, LC_CTYPE=fr_FR (charmap=ISO-8859-1)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#387101: patch

2006-09-12 Thread frealek
Sorry, we had a lack of communication down here... our dev did a change and 
didn't
change the changelog of our custom debian package...


Here is the patch he made
(against 0.1.a-4 I think)

Perhaps it's easily tune-able for 0.2

Regards,

--- restartd-0.1.a/main.c   2006-03-24 11:01:01.0 +0100
+++ restartd-0.1.a-2/main.c 2006-05-08 13:22:33.0 +0200
@@ -78,6 +78,7 @@
 
   debug = 0;
   check_interval = 20;
+  foreground = 0;
   
   // Options
   
@@ -95,6 +96,9 @@
 
 if (!strcmp(argv[i], -d) || !strcmp(argv[i], --debug))
debug = 1;
+
+if (!strcmp(argv[i], -f) || !strcmp(argv[i], --foreground))
+   foreground = 1;
 
 if (!strcmp(argv[i], -i) || !strcmp(argv[i], --interval)) {
if (atoi(argv[i + 1])  0) {
@@ -112,7 +116,8 @@
 printf(restartd is a GNU/GPL software.\n);
 printf(Parameters:\n);
 printf(   -c config_file : config file (default is 
/etc/restartd.conf)\n);
-printf(   -d   : set debug on. (pooor)\n);
+printf(   -d   : set debug on. (poor)\n);
+printf(   -f   : run in foreground\n);
 printf(   -i interval_sec: the check interval in second\n);
 printf(   -h   : help\n\n);
  }
@@ -127,7 +132,7 @@
 
   read_config ();
 
-  syslog (LOG_INFO, Config file has read. Found %d process to check.,
+  syslog (LOG_INFO, Config file has been read. Found %d process to check.,
  config_process_number);
 
   procdir_dirent = malloc (sizeof (struct dirent));
@@ -142,15 +147,17 @@
 
 
   // Fork
-  if (!(child = fork ()))
+  if (foreground == 1 || !(child = fork ()))
 {
 
   // generic daemon stuff from 
http://www.aarnet.edu.au/~gdt/articles/2003-09-nowhere-daemon/daemon.html
   // added by [EMAIL PROTECTED] - 041216
-  if (setsid() == (pid_t)(-1)) {
- fprintf (stderr, setsid failed\n);
- syslog (LOG_ERR, setsid failed);
- return -1;
+  if (!foreground) {
+ if (setsid() == (pid_t)(-1)) {
+fprintf (stderr, setsid failed\n);
+syslog (LOG_ERR, setsid failed);
+return -1;
+ }
   }
   if ((chdir(/))  0) {
  syslog (LOG_ERR, cannot chdir to /);