diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-02 18:08:53 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-02 18:08:53 +0000 |
commit | b0fe419fa0f83ab3755367c1803167568a11a722 (patch) | |
tree | afc706b202a96a20aa6d65f8758d29af143c7cae /src | |
parent | 1d918f525e73c5061e4ad9e17d745455b6837ace (diff) |
Added pid file support, and documentation for it
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@950 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 4 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index eda78a84b..d6bfb40e6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3386,6 +3386,10 @@ int InspIRCd(void) Exit(ERROR); } } + + char PID[MAXBUF]; + ConfValue("pid","file",0,PID,&config_f); + WritePID(PID); /* setup select call */ diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 7a2ad99f8..19f853ddb 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -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) { |