summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorAndreas Eversberg2009-03-15 09:20:20 +0100
committerAndreas Eversberg2009-03-15 09:20:20 +0100
commitc6a9035ac6bb8635922c72ba1b6ccf029adb5e17 (patch)
tree7ad2c398467a9ff0f99b26363f9b3e813a9cbdac /main.c
parentBugfix on interface reload. (diff)
downloadlcr-c6a9035ac6bb8635922c72ba1b6ccf029adb5e17.tar.gz
lcr-c6a9035ac6bb8635922c72ba1b6ccf029adb5e17.tar.xz
lcr-c6a9035ac6bb8635922c72ba1b6ccf029adb5e17.zip
Added PID file (thanx to Joerg)
modified: README modified: main.c
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.c b/main.c
index 0a85f46..73cfe49 100644
--- a/main.c
+++ b/main.c
@@ -314,6 +314,7 @@ int main(int argc, char *argv[])
if (!(strcasecmp(argv[1],"fork")))
{
pid_t pid;
+ FILE *pidfile;
/* do daemon fork */
pid = fork();
@@ -344,6 +345,11 @@ int main(int argc, char *argv[])
exit(0);
}
nooutput = 1;
+
+ /* write pid file */
+ pidfile = fopen("/var/run/lcr.pid","w");
+ fprintf(pidfile, "%d\n", getpid());
+ fclose(pidfile);
} else
/* if not start */
if (!!strcasecmp(argv[1],"start"))