Add support for /var/run/ directory.

This commit is contained in:
kestes%walrus.com 2001-10-18 15:05:57 +00:00
Родитель 92e5a57fa1
Коммит 892bf124a5
4 изменённых файлов: 54 добавлений и 9 удалений

Просмотреть файл

@ -2,8 +2,8 @@
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# $Revision: 1.16 $
# $Date: 2001/10/10 15:06:48 $
# $Revision: 1.17 $
# $Date: 2001/10/18 15:05:57 $
# $Author: kestes%walrus.com $
# $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/bin/tinder.cgi,v $
# $Name: $
@ -444,7 +444,20 @@ sub daemon_main {
symlink ($UID, $FileStructure::LOCK_FILE) ||
return ;
# This file makes writing /etc/rc.d/inid.d scripts easier and its
# naming and location are OS specific.
# Why have two separate files? (both lock and pid could be combined)
# It is convienient for debugging to move the lock file into the
# HTML tree along with the DB files so that the state gets cleaned
# if I wipe the HTML dir. Howver the init scripts always look for
# the pid file in the same place and I find these scripts
# convienient for stopping programs even when debugging.
my $pid="$$\n";
overwrite_file($PID_FILE, $pid);
my ($summary_data);
my (@trees) = TreeData::get_all_trees();

Просмотреть файл

@ -32,8 +32,8 @@
# complete rewrite by Ken Estes, Mail.com (kestes@staff.mail.com).
# Contributor(s):
# $Revision: 1.9 $
# $Date: 2001/09/06 18:15:53 $
# $Revision: 1.10 $
# $Date: 2001/10/18 15:05:53 $
# $Author: kestes%walrus.com $
# $Name: $
@ -294,6 +294,9 @@ sub fatal_error {
print LOG "[$LOCALTIME] $_";
}
print LOG "\n";
unlink ($PID_FILE);
die("\n");
}
@ -331,6 +334,19 @@ sub daemonize {
setsid;
umask 0;
# Do I want to stop multiple instances from running? I am not
# sure how to deal with multiple instances.
if ($PID_FILE) {
die("Pid file: $PID_FILE already exists.\n");
}
# This file makes writing /etc/rc.d/inid.d scripts easier and its
# naming and location are OS specific.
my $pid="$$\n";
overwrite_file($PID_FILE, $pid);
print "$PROGRAM pid: $$\n";
return ;

Просмотреть файл

@ -5,8 +5,8 @@
# customizable settings.
# $Revision: 1.13 $
# $Date: 2001/10/10 15:09:06 $
# $Revision: 1.14 $
# $Date: 2001/10/18 15:05:51 $
# $Author: kestes%walrus.com $
# $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/default_conf/TinderConfig.pm,v $
# $Name: $
@ -103,6 +103,12 @@ $ERROR_LOG = "/var/log/tinderbox2/tinderbox2.log";
# Where the daemon mode lock (for all trees) is placed
$LOCK_FILE = $TINDERBOX_HTML_DIR."/tinderd.lock";
# Where to place file containing pid, this file makes writing
# /etc/rc.d/inid.d scripts easier and its naming and location are OS
# specific.
$PID_DIR = "/var/run/";
# The time between auto refreshes for all pages in seconds.
$REFRESH_TIME = (60 * 15);

Просмотреть файл

@ -3,8 +3,8 @@
# Utils.pm - General purpose utility functions. Every project needs a
# kludge bucket for common access.
# $Revision: 1.23 $
# $Date: 2001/10/10 15:08:24 $
# $Revision: 1.24 $
# $Date: 2001/10/18 15:05:48 $
# $Author: kestes%walrus.com $
# $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/lib/Utils.pm,v $
# $Name: $
@ -121,6 +121,15 @@ sub set_static_vars {
$LOCK_FILE = ( $TinderConfig::LOCK_FILE ||
"/usr/apache/cgibin/webtools/tinderbox/tinderd.lock");
# Where to place file containing pid, this file makes writing
# /etc/rc.d/inid.d scripts easier and its naming and location are OS
# specific.
$PID_DIR = ( $TinderConfig::PID_DIR ||
"/var/run/");
$PID_FILE= "$PID_DIR/$PROGRAM.pid";
# the time between auto refreshes for all pages in seconds.
$REFRESH_TIME = ( $TinderConfig::REFRESH_TIME ||
@ -398,6 +407,7 @@ sub fatal_error {
# we have trouble removing the file we we will be exiting anyway.
unlink ($LOCK_FILE);
unlink ($PID_FILE);
print "Content-type: text/html\n\n";