mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Added pid file support, and documentation for it
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@950 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
1d918f525e
commit
b0fe419fa0
@ -238,14 +238,25 @@
|
||||
<files motd="/home/cc/inspircd-1.0/conf/inspire.motd"
|
||||
rules="/home/cc/inspircd-1.0/conf/inspire.rules">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- RTFM LINE -#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-# DNS SERVER -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# #
|
||||
# Define your DNS server address here. InspIRCd has its own resolver #
|
||||
# and you must define this otherwise nobody's host will resolve. The #
|
||||
# timeout value is in seconds. #
|
||||
# #
|
||||
|
||||
<dns server="127.0.0.1" timeout="5">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-# PID FILE -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# #
|
||||
# Define the path to the PID file here. The PID file can be used to #
|
||||
# rehash the ircd from the shell or to terminate the ircd from the #
|
||||
# shell using shell scripts, perl scripts etc, and to monitor the #
|
||||
# ircd's state via cron jobs. #
|
||||
# #
|
||||
|
||||
<pid file="/path/to/inspircd.pid">
|
||||
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- RTFM LINE -#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# #
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
void Exit (int);
|
||||
void Start (void);
|
||||
@ -29,4 +30,4 @@ int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int i
|
||||
int ConfValueEnum(char* tag,std::stringstream *config);
|
||||
int EnumConf(std::stringstream *config_f,const char* tag);
|
||||
int EnumValues(std::stringstream *config, const char* tag, int index);
|
||||
|
||||
void WritePID(std::string filename);
|
||||
|
@ -3386,6 +3386,10 @@ int InspIRCd(void)
|
||||
Exit(ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
char PID[MAXBUF];
|
||||
ConfValue("pid","file",0,PID,&config_f);
|
||||
WritePID(PID);
|
||||
|
||||
|
||||
/* setup select call */
|
||||
|
@ -67,6 +67,20 @@ void Start (void)
|
||||
printf("\033[1;37mName concept:\033[0;37m Lord_Zathras\n\n");
|
||||
}
|
||||
|
||||
void WritePID(std::string filename)
|
||||
{
|
||||
ofstream outfile(filename.c_str());
|
||||
if (outfile.is_open())
|
||||
{
|
||||
outfile << getpid();
|
||||
outfile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to write PID-file '%s', exiting.\n",filename.c_str());
|
||||
Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DeadPipe(int status)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user