mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
[lcd4linux @ 2003-08-08 08:05:23 by reinelt]
added PID file handling git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@208 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
18
lcd4linux.c
18
lcd4linux.c
@@ -1,4 +1,4 @@
|
||||
/* $Id: lcd4linux.c,v 1.40 2003/08/08 06:58:06 reinelt Exp $
|
||||
/* $Id: lcd4linux.c,v 1.41 2003/08/08 08:05:23 reinelt Exp $
|
||||
*
|
||||
* LCD4Linux
|
||||
*
|
||||
@@ -20,6 +20,9 @@
|
||||
*
|
||||
*
|
||||
* $Log: lcd4linux.c,v $
|
||||
* Revision 1.41 2003/08/08 08:05:23 reinelt
|
||||
* added PID file handling
|
||||
*
|
||||
* Revision 1.40 2003/08/08 06:58:06 reinelt
|
||||
* improved forking
|
||||
*
|
||||
@@ -217,10 +220,13 @@
|
||||
|
||||
#include "cfg.h"
|
||||
#include "debug.h"
|
||||
#include "pid.h"
|
||||
#include "udelay.h"
|
||||
#include "display.h"
|
||||
#include "processor.h"
|
||||
|
||||
#define PIDFILE "/var/run/lcd4linux.pid"
|
||||
|
||||
char *release="LCD4Linux " VERSION " (c) 2003 Michael Reinelt <reinelt@eunet.at>";
|
||||
char **my_argv;
|
||||
char *output=NULL;
|
||||
@@ -428,6 +434,14 @@ int main (int argc, char *argv[])
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
close(fd);
|
||||
|
||||
// create PID file
|
||||
if (pid_init(PIDFILE)!=0) {
|
||||
error ("PID file creation failed!");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
// now we are a daemon
|
||||
background=1;
|
||||
}
|
||||
|
||||
@@ -469,6 +483,8 @@ int main (int argc, char *argv[])
|
||||
if (!quiet) hello();
|
||||
lcd_quit();
|
||||
|
||||
pid_exit(PIDFILE);
|
||||
|
||||
if (got_signal==SIGHUP) {
|
||||
long fd;
|
||||
debug ("restarting...");
|
||||
|
||||
Reference in New Issue
Block a user