63 local pidfile = config.get("*", "core", "pidfile"); |
63 local pidfile = config.get("*", "core", "pidfile"); |
64 if not pidfile then |
64 if not pidfile then |
65 return false, "no-pidfile"; |
65 return false, "no-pidfile"; |
66 end |
66 end |
67 |
67 |
68 local file, err = io.open(pidfile, "w"); |
68 local file, err = io.open(pidfile, "r+"); |
69 if not file then |
69 if not file then |
70 return false, "pidfile-read-failed", err; |
70 return false, "pidfile-read-failed", err; |
71 end |
71 end |
72 |
72 |
73 local locked, err = lfs.lock(file, "w"); |
73 local locked, err = lfs.lock(file, "w"); |