%mode 0750
#!/usr/bin/env perl
-
#
# InspIRCd -- Internet Relay Chat Daemon
#
my $basepath = "@BASE_DIR@";
my $confpath = "@CONFIG_DIR@";
my $binpath = "@BINARY_DIR@";
-my $runpath = "@BASE_DIR@";
-my $datadir = "@DATA_DIR@";
+my $runtimedir = "@RUNTIME_DIR@";
my $valgrindlogpath = "$basepath/valgrindlogs";
my $executable = "inspircd";
my $version = "@VERSION_FULL@";
my @cmds = grep /^cmd_/, @subs;
my @devs = grep /^dev_/, @subs;
local $_;
- $_ =~ s/^(cmd|dev)_// foreach (@cmds, @devs);
- $_ =~ s/_/-/g foreach (@cmds, @devs);
+ $_ =~ s/^(cmd|dev)_// for (@cmds, @devs);
+ $_ =~ s/_/-/g for (@cmds, @devs);
print STDERR "Usage: ./inspircd (" . join("|", @cmds) . ")\n";
print STDERR "Developer arguments: (" . join("|", @devs) . ")\n";
exit GENERIC_EXIT_SUCCESS;
{
if (getstatus() == 1) {
my $pid = getprocessid();
- system("kill -HUP $pid >/dev/null 2>&1");
+ kill HUP => $pid;
print "InspIRCd rehashed (pid: $pid).\n";
exit GENERIC_EXIT_SUCCESS;
} else {
{
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; exit GENERIC_EXIT_SUCCESS; }
+
# If we are still alive here.. Try starting the IRCd..
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
#Check we have gdb
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
# Check to see its not 'running' already.
if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
- chdir $runpath;
print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
# Generic Helper Functions.
###
-# GetPidfile Version 2 - Now With Include Support..
-# I beg for months for include support in insp, then..
-# when it is added, it comes around and BITES ME IN THE ASS,
-# because i then have to code support into this script.. Evil.
-
-# Craig got bitten in the ass again --
-# in 1.1 beta the include file is manditory, therefore
-# if we cant find it, default to %conf%/inspircd.pid.
-# Note, this also contains a fix for when the pid file is
-# defined, but defined in a comment (line starts with #)
-# -- Brain
-
my %filesparsed;
sub getpidfile
if (($i =~ /<pid file=\"(\S+)\">/i) && ($i !~ /^#/))
{
# Set the PID file and return.
- $pidfile = expand_fragment $datadir, $1;
+ $pidfile = expand_fragment $runtimedir, $1;
return;
}
}
}
# End of includes / No includes found. Using default.
- $pidfile = $datadir . "/inspircd.pid";
+ $pidfile = $runtimedir . "/inspircd.pid";
}
sub getstatus {