severity 387101 wishlist retitle 387101 restartd: Please add a "-f" option to run restartd in foreground thanks
On Tue, Sep 12, 2006 at 11:04:00AM +0200, frealek wrote: > Restard version 0.1.a-4 has a '-f' (run in foreground) option. You are mistaken. There was not any "-f" option to restartd, be it in 0.1.a-4 or in 0.2. Please look at the source code for yourself. For you convenience, I am attaching the diff between the versions in Sarge (0.1.a-3) and in Etch (0.2). Moreover, the manpage and the changelog never mentioned such an 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. Also, it seems you want one, but I have no usage to do it for myself. Hence, you are welcome to provide a patch I will gladly and promptly integrate into a 0.2.1 release. :) Cheers, -- .''`. Aurélien GÉRÔME : :' : `. `'` Free Software Developer `- Unix Sys & Net Admin
diff -ruN restartd-0.1.a/debian/README.Debian restartd-0.2/debian/README.Debian
--- restartd-0.1.a/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000
+++ restartd-0.2/debian/README.Debian 2006-07-22 22:39:17.000000000 +0000
@@ -0,0 +1,8 @@
+Note concerning system upgrades
+-------------------------------
+
+Before issuing any upgrade commands, it is recommended to stop restartd
+to avoid it to restart its watched deamons. After the upgrade, it is
+necessary to start it.
+
+ -- Aurélien GÉRÔME <[EMAIL PROTECTED]> Sat, 22 Jul 2006 00:11:39 +0200
diff -ruN restartd-0.1.a/debian/changelog restartd-0.2/debian/changelog
--- restartd-0.1.a/debian/changelog 2002-08-12 14:21:10.000000000 +0000
+++ restartd-0.2/debian/changelog 2006-07-22 22:41:59.000000000 +0000
@@ -1,19 +1,50 @@
+restartd (0.2) unstable; urgency=low
+
+ * Adopt the package (Closes: #358514).
+ * Update to the latest Standards-Version.
+ * Throw away Debian revision number, because it is a native package.
+ * Add README.Debian with a note concerning system upgrades
+ (Closes: #191302).
+
+ -- Aurélien GÉRÔME <[EMAIL PROTECTED]> Sat, 22 Jul 2006 00:11:39 +0200
+
+restartd (0.1.a-4) unstable; urgency=low
+
+ * QA upload.
+ * Package is orphaned (#358514); set maintainer to Debian QA Group.
+ * Acknowledge NMU. Closes: #264232, #281179, #281961, #282328.
+ * debian/rules: Add support for DEB_BUILD_OPTIONS=noopt.
+ * debian/changelog: Remove obsolete Emacs local variables.
+
+ -- Matej Vela <[EMAIL PROTECTED]> Thu, 6 Apr 2006 11:20:04 +0200
+
+restartd (0.1.a-3.1) unstable; urgency=low
+
+ * NMU to fix packaging problems:
+ - update debhelper usage, standards-version, add force-reload to
+ initscript (closes: #264232);
+ - update FSF address in copyright;
+ - add license pointer to copyright (closes: #281179).
+ * Redirect std* to /dev/null and change cdw to '/' thanks to
+ "Christian G. Warden" <[EMAIL PROTECTED]> for the patch
+ (closes: #281961, #282328).
+
+ -- Laszlo Boszormenyi (GCS) <[EMAIL PROTECTED]> Fri, 24 Mar 2006 10:53:48
+0100
+
restartd (0.1.a-3) unstable; urgency=low
* Fixed memory leak, forgot regfree(3) after regular expression. Closes:
bug#155220
-- Tibor Koleszar <[EMAIL PROTECTED]> Thu, 20 Jun 2002 16:20:31 +0100
+
restartd (0.1.a-2) unstable; urgency=low
* Fixed typos. Closes: bug#150375
-- Tibor Koleszar <[EMAIL PROTECTED]> Thu, 20 Jun 2002 09:28:12 +0100
+
restartd (0.1.a-1) unstable; urgency=low
* Initial release.
-- Tibor Koleszar <[EMAIL PROTECTED]> Tue, 11 Jun 2002 14:54:37 +0100
-
-Local variables:
-mode: debian-changelog
-End:
diff -ruN restartd-0.1.a/debian/compat restartd-0.2/debian/compat
--- restartd-0.1.a/debian/compat 1970-01-01 00:00:00.000000000 +0000
+++ restartd-0.2/debian/compat 2006-03-24 09:46:11.000000000 +0000
@@ -0,0 +1 @@
+4
diff -ruN restartd-0.1.a/debian/conffiles restartd-0.2/debian/conffiles
--- restartd-0.1.a/debian/conffiles 2002-06-11 13:43:56.000000000 +0000
+++ restartd-0.2/debian/conffiles 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-/etc/restartd.conf
-/etc/init.d/restartd
diff -ruN restartd-0.1.a/debian/control restartd-0.2/debian/control
--- restartd-0.1.a/debian/control 2002-06-20 07:27:12.000000000 +0000
+++ restartd-0.2/debian/control 2006-07-22 22:11:08.000000000 +0000
@@ -1,9 +1,9 @@
Source: restartd
Section: utils
Priority: extra
-Maintainer: Tibor Koleszar <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>> 3.0.0)
-Standards-Version: 3.5.2
+Maintainer: Aurélien GÉRÔME <[EMAIL PROTECTED]>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.7.2
Package: restartd
Architecture: any
diff -ruN restartd-0.1.a/debian/copyright restartd-0.2/debian/copyright
--- restartd-0.1.a/debian/copyright 2002-06-11 12:57:27.000000000 +0000
+++ restartd-0.2/debian/copyright 2006-03-24 09:49:50.000000000 +0000
@@ -16,8 +16,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ along with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- Tibor Koleszar <[EMAIL PROTECTED]>
- H-7400 Kaposvar, Somssich Pal str. 4.
+On Debian systems, the complete text of the GPLv2 is in the file
+/usr/share/common-licenses/GPL-2
diff -ruN restartd-0.1.a/debian/init.d restartd-0.2/debian/init.d
--- restartd-0.1.a/debian/init.d 2002-06-11 13:40:02.000000000 +0000
+++ restartd-0.2/debian/init.d 2006-03-24 09:53:05.000000000 +0000
@@ -41,12 +41,12 @@
$DAEMON $PARAMS
echo "restartd."
;;
- reload)
+ reload|force-reload)
echo "Reloading restartd configuration files"
kill -HUP `cat /var/run/restartd.pid`
;;
*)
- echo "Usage: /etc/init.d/restartd {start|stop|restart|reload}"
+ echo "Usage: /etc/init.d/restartd {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
diff -ruN restartd-0.1.a/debian/rules restartd-0.2/debian/rules
--- restartd-0.1.a/debian/rules 2002-06-11 13:31:03.000000000 +0000
+++ restartd-0.2/debian/rules 2006-07-22 22:20:54.000000000 +0000
@@ -3,16 +3,19 @@
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
-export DH_VERBOSE=1
+#export DH_VERBOSE=1
-# This is the debhelper compatability version to use.
-export DH_COMPAT=3
+C_ARGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ C_ARGS += -O0
+else
+ C_ARGS += -O2
+endif
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
-
touch configure-stamp
@@ -22,7 +25,7 @@
dh_testdir
# Add here commands to compile the package.
- $(MAKE)
+ $(MAKE) C_ARGS="$(C_ARGS)"
touch build-stamp
@@ -45,7 +48,6 @@
# Add here commands to install the package into debian/restartd.
$(MAKE) install DESTDIR=$(CURDIR)/debian/restartd
-
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
diff -ruN restartd-0.1.a/main.c restartd-0.2/main.c
--- restartd-0.1.a/main.c 2002-08-12 14:19:04.000000000 +0000
+++ restartd-0.2/main.c 2006-03-24 10:01:01.000000000 +0000
@@ -67,7 +67,7 @@
char *proc_cmdline_str;
ssize_t proc_cmdline_str_length;
char *proc_cmdline_name;
- int i;
+ int i, f;
FILE *out_proc;
regex_t *regc;
size_t r_nmatch = 0;
@@ -145,6 +145,54 @@
if (!(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 ((chdir("/")) < 0) {
+ syslog (LOG_ERR, "cannot chdir to /");
+ return -1;
+ }
+ f = open("/dev/null", O_RDONLY);
+ if (f == -1)
+ {
+ syslog (LOG_ERR, "failed to open /dev/null");
+ return -1;
+ }
+ else
+ {
+ if (dup2(f, fileno(stdin)) == -1)
+ {
+ syslog (LOG_ERR, "failed to set stdin to /dev/null");
+ return -1;
+ }
+ (void)close(f);
+ }
+
+ f = open("/dev/null", O_WRONLY);
+ if (f == -1)
+ {
+ syslog (LOG_ERR, "failed to open /dev/null");
+ return -1;
+ }
+ else
+ {
+ if (dup2(f, fileno(stdout)) == -1)
+ {
+ syslog (LOG_ERR, "failed to set stdout to /dev/null");
+ return -1;
+ }
+ if (dup2(f, fileno(stderr)) == -1)
+ {
+ syslog (LOG_ERR, "failed to set stderr to /dev/null");
+ return -1;
+ }
+ (void)close(f);
+ }
+
out_proc = fopen("/var/run/restartd.pid", "wt");
fprintf(out_proc, "%d", getpid());
fclose(out_proc);
@@ -154,7 +202,6 @@
if ((procdir_id = opendir ("/proc")) == NULL)
{
- fprintf (stderr, "%s: cannot open /proc dir.\n", argv[0]);
syslog (LOG_ERR, "cannot open /proc dir");
return -1;
}
diff -ruN restartd-0.1.a/restartd.conf restartd-0.2/restartd.conf
--- restartd-0.1.a/restartd.conf 2002-06-11 13:00:49.000000000 +0000
+++ restartd-0.2/restartd.conf 2006-03-24 10:20:55.000000000 +0000
@@ -18,3 +18,6 @@
#
# restartd ".*restartd" "/bin/echo 'its not running' >
/tmp/restartd.out" "/bin/echo 'its running' > /tmp/restartd.out"
#
+# For example:
+#cron ".*/cron" "/bin/echo '!cron' >/dev/null" "/bin/echo 'cron' >/dev/null"
+#
signature.asc
Description: Digital signature

