Skip to content

Commit 3f72e40

Browse files
committed
Better PID file handling
1 parent 8fa4e15 commit 3f72e40

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

common/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def pid_file_name(node_type: str, node_name: str) -> str:
4949
The name of the file that is used to store the process ID.
5050
"""
5151
file_name = f"dske-{node_type}-{node_name}.pid"
52-
dir_name = "/var/run"
53-
if os.path.exists(dir_name) and os.access(dir_name, os.W_OK):
52+
dir_name = "/tmp" # /var/run would be better, but typically needs root access
53+
if os.access(dir_name, os.W_OK):
5454
return f"{dir_name}/{file_name}"
55+
# /tmp does not exist or is not writable, use current directory
5556
return file_name
5657

5758

0 commit comments

Comments
 (0)