X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=.inspircd.inc;h=54737fdd78c66fd66611bf6bdb8871566ee14942;hb=4799d8d066114204c5aa8483dace93ccb00850e1;hp=cb59bc3cb47f5f50cf4b82343c538ed4baa337e0;hpb=ffe8c3ce60e83c48aa393fa718602c070f4149e2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/.inspircd.inc b/.inspircd.inc index cb59bc3cb..54737fdd7 100644 --- a/.inspircd.inc +++ b/.inspircd.inc @@ -15,10 +15,12 @@ # I HATE PERL.. kthxbye # --------------------------------------------------- -my $confpath = "@CONFIG_DIR@/"; -my $binpath = "@BINARY_DIR@"; -my $libpath = "@LIBRARY_DIR@"; -my $executable = "@EXECUTABLE@"; +my $basepath = "@BASE_DIR@"; +my $confpath = "@CONFIG_DIR@/"; +my $binpath = "@BINARY_DIR@"; +my $libpath = "@LIBRARY_DIR@"; +my $executable = "@EXECUTABLE@"; +my $version = "@VERSION@"; my @filesparsed; # Lets see what they want to do.. Set the variable (Cause i'm a lazy coder) @@ -58,8 +60,14 @@ if ($arg eq "cron") { exit(); } +if ($arg eq "version") { + print "InspIRCd version: $version\n"; + exit(); +} + if ($arg eq "restart") { stop(); + unlink($pidfile) if (-e $pidfile); start(); # kthxbye(); exit(); @@ -75,7 +83,7 @@ if ($arg eq "Cheese-Sandwich") { # If we get here.. bad / no parameters. ### print "Invalid Argument: $arg\n"; -print "Usage: inspircd (start|stop|restart|rehash|status|cron)\n"; +print "Usage: inspircd (start|stop|restart|rehash|status|cron|version)\n"; exit(); ### @@ -86,6 +94,8 @@ sub start { # Check to see its not 'running' already. if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; } # If we are still alive here.. Try starting the IRCd.. + print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable"); + system("$binpath/$executable"); return 1; } @@ -93,12 +103,14 @@ sub start { sub debug { # Check to see its not 'running' already. if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; } - + + print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable"); + # Check we have gdb checkgdb(); # If we are still alive here.. Try starting the IRCd.. - system("gdb --command=.gdbargs --args $binpath/$executable -nofork -debug -nolog"); + system("gdb --command=$basepath/.gdbargs --args $binpath/$executable -nofork -debug -nolog"); } sub screendebug @@ -106,6 +118,8 @@ sub screendebug # Check to see its not 'running' already. if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; } + print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable"); + #Check we have gdb checkgdb(); checkscreen(); @@ -113,7 +127,7 @@ sub screendebug # If we are still alive here.. Try starting the IRCd.. print "Starting InspIRCd in `screen`, type `screen -r` when the ircd crashes to view the gdb output and get a backtrace.\n"; print "Once you're inside the screen session press ^C + d to re-detach from the session\n"; - system("screen -m -d gdb --command=.gdbargs --args $binpath/$executable -nofork -debug -nolog"); + system("screen -m -d gdb --command=$basepath/.gdbargs --args $binpath/$executable -nofork -debug -nolog"); } sub valdebug @@ -121,6 +135,8 @@ sub valdebug # Check to see its not 'running' already. if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; } + print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable"); + # Check we have valgrind and gdb checkvalgrind(); checkgdb(); @@ -136,6 +152,8 @@ sub screenvaldebug # Check to see its not 'running' already. if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; } + print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable"); + #Check we have gdb checkvalgrind(); checkgdb(); @@ -224,7 +242,7 @@ sub getpidfile { } } else { # End of includes / No includes found. - return; + return $confpath . "inspircd.pid"; } } }