mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
added pidfile check in piler.c to prevent multiple start of the piler daemon
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
e03a9f2982
commit
bef68aec3a
@ -11,7 +11,7 @@
|
||||
|
||||
#define VERSION "1.3.2"
|
||||
|
||||
#define BUILD 983
|
||||
#define BUILD 985
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define ERR_TIMED_OUT "ERR: timed out"
|
||||
#define ERR_FORK_FAILED "ERR: cannot fork()"
|
||||
#define ERR_OPEN_DEDUP_FILE "ERR: cannot open dedup file"
|
||||
#define ERR_PID_FILE_EXISTS "ERR: pidfile exists. If piler daemon is not running, and the pidfile exists (unclean shutdown?) then remove it, and start piler again"
|
||||
|
||||
#define ERR_MYSQL_CONNECT "Cannot connect to mysql server"
|
||||
#define ERR_PSQL_CONNECT "Cannot connect to PSql server"
|
||||
|
@ -461,6 +461,7 @@ void initialise_configuration(){
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int i, daemonise=0, dedupfd;
|
||||
struct stat st;
|
||||
|
||||
|
||||
while((i = getopt(argc, argv, "c:dvVh")) > 0){
|
||||
@ -509,6 +510,8 @@ int main(int argc, char **argv){
|
||||
|
||||
if(drop_privileges(pwd)) fatal(ERR_SETUID);
|
||||
|
||||
if(stat(cfg.pidfile, &st) == 0) fatal(ERR_PID_FILE_EXISTS);
|
||||
|
||||
if(cfg.mmap_dedup_test == 1){
|
||||
dedupfd = open(MESSAGE_ID_DEDUP_FILE, O_RDWR);
|
||||
if(dedupfd == -1) fatal(ERR_OPEN_DEDUP_FILE);
|
||||
|
Loading…
Reference in New Issue
Block a user