From dd87cc4560f4f7817743fccff9b0a974c292f841 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 16 Mar 2009 09:17:56 +0000 Subject: [PATCH] new upstream release --- debian/changelog | 7 +- debian/control | 2 +- debian/patches/00list | 1 - debian/patches/01_add_pidfile_support.dpatch | 108 ------------------- debian/rules | 6 +- 5 files changed, 8 insertions(+), 116 deletions(-) delete mode 100644 debian/patches/00list delete mode 100644 debian/patches/01_add_pidfile_support.dpatch diff --git a/debian/changelog b/debian/changelog index 1d89b7c..7ebf6aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ -ps-watcher (1.07-2) UNRELEASED; urgency=low +ps-watcher (1.08-1) UNRELEASED; urgency=low - * NOT RELEASED YET + * new upstream release + - pidfile support + - darwin support + * remove dpatch infrastructure -- Jan Wagner Thu, 19 Feb 2009 17:31:31 +0100 diff --git a/debian/control b/debian/control index 2a45362..a4efd6d 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: ps-watcher Section: admin Priority: extra Maintainer: Jan Wagner -Build-Depends: debhelper (>= 5), dpatch +Build-Depends: debhelper (>= 5) Build-Depends-Indep: autotools-dev, libconfig-inifiles-perl, perl-modules Homepage: http://ps-watcher.sourceforge.net/ Vcs-Browser: https://trac.cyconet.org/debian/browser/debian/ps-watcher diff --git a/debian/patches/00list b/debian/patches/00list deleted file mode 100644 index 4b77285..0000000 --- a/debian/patches/00list +++ /dev/null @@ -1 +0,0 @@ -01_add_pidfile_support.dpatch diff --git a/debian/patches/01_add_pidfile_support.dpatch b/debian/patches/01_add_pidfile_support.dpatch deleted file mode 100644 index 7167245..0000000 --- a/debian/patches/01_add_pidfile_support.dpatch +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 01_add_pidfile_support.dpatch by Jan Wagner -## with hints by Sebastian Harl and -## Alexander Wirt -## -## DP: add pidfile support to ps-watcher - - ---- ps-watcher-1.06/ps-watcher.in.in 2007-07-04 21:34:23.000000000 +0200 -+++ ps-watcher-1.06/ps-watcher.in.in 2008-04-02 18:16:45.000000000 +0200 -@@ -23,8 +23,11 @@ - - use vars qw($program $ps_cmd $ps_cmdfull $ps_fullcmd_fmt @ps_vars $ps_dvars - $0 $logopened $ps_args_fmt $args -- $count $pid $command $ps_arg_opts $DEVNULL %opts -+ $count $pid $command $ps_arg_opts $DEVNULL %opts $PIDFILE - ); -+ -+$PIDFILE = "/var/run/ps-watcher.pid"; -+ - use strict; - BEGIN { require 5.00503 } - -@@ -130,6 +133,7 @@ - sub read_config($); - sub check_config_file($); - sub run_trigger($$$); -+sub check_pid(); - - init(); - process_options(); -@@ -147,7 +151,12 @@ - } - - if ($opts{daemon}) { -- daemonize(); -+ if (! check_pid()) { -+ exit 1; -+ } -+ if (! daemonize()) { -+ exit 1; -+ } - } - - install_handlers(); -@@ -584,14 +593,62 @@ - exit 10; - } - -+sub check_pid() { -+ if (-f $PIDFILE) { -+ if (open(PID,$PIDFILE)) { -+ my $pid = ; -+ if (!close(PID)) { -+ logger("Unable to close file handle PID for file '$PIDFILE': $!"); -+ return; -+ } -+ if (-f "/proc/$pid/stat") { -+ if (open(FH,"/proc/$pid/stat")) { -+ my $line = ; -+ if (!close(FH)) { -+ logger("Unable to close file handle FH for file '/proc/$pid/stat': $!"); -+ return; -+ } -+ if ($line =~ /\d+[^(]*\((.*)\)\s*/) { -+ my $process = $1; -+ if ($process =~ /^$program$/) { -+ logger("$program already running at PID $pid; exiting."); -+ exit(0); -+ } -+ } -+ } else { -+ logger("Unable to open file handle FH for file '/proc/$pid/stat': $!"); -+ return; -+ } -+ } else { -+ logger("Removing stale PID file."); -+ unlink($PIDFILE); -+ } -+ }else{ -+ logger("Unable to open file handle PID for file '$PIDFILE': $!"); -+ return; -+ } -+ } -+ return 1; -+} - - sub daemonize() { - chdir '/' or die "Can't chdir to /: $!"; - defined(my $pid = fork) or die "Can't fork: $!"; - exit 0 if $pid; -+ if (open(FH,">$PIDFILE")) { -+ print FH $$; -+ if (!close(FH)) { -+ logger("Unable to close file handle FH for file '$PIDFILE': $!"); -+ return; -+ } -+ } else { -+ logger("Unable to open file handle FH for file '$PIDFILE': $!"); -+ return; -+ } - use POSIX qw(setsid); - setsid() or die "Can't start a new session: $!"; - umask 0; -+ return 1; - } - - # Time configuration file was last read. diff --git a/debian/rules b/debian/rules index 9fd48b9..0ddd3d5 100755 --- a/debian/rules +++ b/debian/rules @@ -4,9 +4,7 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -include /usr/share/dpatch/dpatch.make - -config.status: patch-stamp configure +config.status: configure dh_testdir ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub @@ -26,7 +24,7 @@ build-stamp: config.status touch $@ -clean: unpatch +clean: dh_testdir dh_testroot rm -f build-stamp