From 3629215ce3c1c4af95e73a9a3054831f4b695b3a Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 19 Jun 2001 21:24:32 +0000 Subject: [PATCH] Added the --nodaemonize option to the 3 daemons. This flag causes the program to not automatically daemonize when invoked. Suggested usage: Run from a monitor, such as init. --- src/spong-client.pl | 11 +++++++---- src/spong-network.pl | 11 +++++++---- src/spong-server.pl | 11 +++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/spong-client.pl b/src/spong-client.pl index 5f4dcd9..89c84bd 100755 --- a/src/spong-client.pl +++ b/src/spong-client.pl @@ -12,7 +12,7 @@ # History: # (1) Ported bb-local.sh script to perl. (Ed Hill Feb 26, 1997) # -# $Id: spong-client.pl,v 1.17 2000/10/16 15:34:32 sljohnson Exp $ +# $Id: spong-client.pl,v 1.18 2001/06/19 21:24:32 supermathie Exp $ use lib '@@LIBDIR@@'; @@ -32,7 +32,8 @@ srand( time() ^ ($$ + ($$ << 15 )) ); $debug = $restart = $kill = $nosleep = 0; if ( ! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart, - "kill" => \$kill, "nosleep|refresh" => \$nosleep ) ) { + "kill" => \$kill, "nosleep|refresh" => \$nosleep, + "nodaemonize" => \$nodaemonize ) ) { &usage(); exit 1; } @@ -50,7 +51,7 @@ $CHECKS = ""; &load_config_files(); # Loads the user specified configuration information &init_logging(); # Initialize logging contexts Spong::Daemon::Daemonize # Daemonize if not signalling or debugging - unless ($restart || $kill || $nosleep || $debug); + unless ($restart || $kill || $nosleep || $debug || $nodaemonize); &handle_signals(); # Set up handlers, and signal the current server if asked # Find our SPONGSLEEP value @@ -102,11 +103,13 @@ sub usage { print qq (Usage: - $0 [--debug n] [--nosleep|--refresh] [config_file] + $0 [--nodaemonize] [--debug n] [--nosleep|--refresh] [config_file] $0 --kill | --restart --debug n Run in the foreround and print debugging output + --nodaemonize + Run without becoming a daemon --nosleep --refresh Run one cycle of checks in the foreground and exit diff --git a/src/spong-network.pl b/src/spong-network.pl index 17539b0..847853e 100755 --- a/src/spong-network.pl +++ b/src/spong-network.pl @@ -17,7 +17,7 @@ # (2) Converted checks to new plugin mechanism (Stephen Johnson May 28, 1999) # Added user-configurable escalation mechanism # -# $Id: spong-network.pl,v 1.37 2001/05/25 14:42:59 sljohnson Exp $ +# $Id: spong-network.pl,v 1.38 2001/06/19 21:24:32 supermathie Exp $ use Carp; use lib "@@LIBDIR@@"; @@ -43,7 +43,8 @@ srand( time() ^ ($$ + ($$ << 15 )) ); $debug = $restart = $kill = 0; if ( ! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart, - "kill" => \$kill, "nosleep|refresh" => \$nosleep ) ) { + "kill" => \$kill, "nosleep|refresh" => \$nosleep, + "nodaemonize" => \$nodaemonize) ) { &usage(); exit 1; } @@ -60,7 +61,7 @@ $HOST =~ tr/A-Z/a-z/; &load_config_files(); # Loads the user specified configuration information &init_logging(); # Initialize logging contexts Spong::Daemon::Daemonize() # Daemonize if not signalling or a one-shot - unless ($nosleep || $restart || $kill || $debug ); + unless ($nosleep || $restart || $kill || $debug || $nodaemonize ); &handle_signals(); # Set up handlers, and signal the current server if asked # Find our SPONGSLEEP value @@ -392,11 +393,13 @@ sub usage { print qq (Usage: - $0 [--debug n] [--nosleep|--refresh] [config_file] + $0 [--nodaemonize] [--debug n] [--nosleep|--refresh] [config_file] $0 --kill | --restart --debug n Run in the foreround and print debugging output + --nodaemonize + Run without becoming a daemon --nosleep --refresh Run one cycle of checks in the foreground and exit diff --git a/src/spong-server.pl b/src/spong-server.pl index a680057..ceade75 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -6,7 +6,7 @@ # There are one or more update processes that listen for status updates # from client programs. -# $Id: spong-server.pl,v 1.41 2001/04/17 02:58:12 sljohnson Exp $ +# $Id: spong-server.pl,v 1.42 2001/06/19 21:24:32 supermathie Exp $ use lib "@@LIBDIR@@"; @@ -36,7 +36,8 @@ $MAX_CHILDREN = 10; $debug = $restart = $kill = 0; if (! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart, - "kill" => \$kill, "test" => \$test ) ) { + "kill" => \$kill, "test" => \$test, + "nodaemonize" => \$nodaemonize) ) { &usage(); exit 1; } @@ -70,7 +71,7 @@ $shutdown = 0; &load_config_files(); # Loads the user specified configuration information &init_logging(); # Initialize logging contexts -Spong::Daemon::Daemonize() unless ($debug || $restart || $kill) ; +Spong::Daemon::Daemonize() unless ($debug || $restart || $kill || $nodaemonize); &handle_signals(); # Set up handlers, and signal the current server if asked # Find our SPONGSLEEP value @@ -141,10 +142,12 @@ sub usage { print qq (Usage: - $0 [--debug [n]] [--restart|--kill] [config_file] + $0 [--nodaemonize] [--debug [n]] [--restart|--kill] [config_file] --debug Run in the foreground and print debugging output. + --nodaemonize + Run without becoming a daemon --restart Signal a running spong-server to restart. --kill -- 2.30.2